diff options
author | Norbert Preining <preining@logic.at> | 2021-04-04 01:53:22 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2021-04-04 01:53:22 +0000 |
commit | c4c34aedd2080aa9180cbd259e124e491aecfd96 (patch) | |
tree | 4d9515b0f761dd745b9b153d2f8fdfb576847f17 /Master/texmf-dist | |
parent | b33e03e753e3f34613edf68fbcece8772a5e859a (diff) |
ekdosis (4apr21)
git-svn-id: svn://tug.org/texlive/trunk@58721 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/lualatex/ekdosis/README.md | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/ekdosis/ekdosis.el | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/ekdosis/ekdosis.pdf | bin | 707134 -> 830931 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/ekdosis/samples/Caesar_BG-6-13-1.pdf | bin | 17992 -> 17995 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/lualatex/ekdosis/Makefile | 34 | ||||
-rw-r--r-- | Master/texmf-dist/source/lualatex/ekdosis/ekdosis.dtx | 2042 | ||||
-rw-r--r-- | Master/texmf-dist/source/lualatex/ekdosis/ekdosis.ins | 2 | ||||
-rw-r--r-- | Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.lua | 185 | ||||
-rw-r--r-- | Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty | 371 |
9 files changed, 2136 insertions, 502 deletions
diff --git a/Master/texmf-dist/doc/lualatex/ekdosis/README.md b/Master/texmf-dist/doc/lualatex/ekdosis/README.md index 9d9e5d06055..51a1e595e6b 100644 --- a/Master/texmf-dist/doc/lualatex/ekdosis/README.md +++ b/Master/texmf-dist/doc/lualatex/ekdosis/README.md @@ -23,7 +23,7 @@ License and Disclamer ===================== ekdosis – Typesetting TEI xml-Compliant Critical Editions -Copyright ⓒ 2020 Robert Alessi +Copyright ⓒ 2020--2021 Robert Alessi Please send error reports and suggestions for improvements to Robert Alessi: diff --git a/Master/texmf-dist/doc/lualatex/ekdosis/ekdosis.el b/Master/texmf-dist/doc/lualatex/ekdosis/ekdosis.el index 3d1547b4c80..74d6bf1745c 100644 --- a/Master/texmf-dist/doc/lualatex/ekdosis/ekdosis.el +++ b/Master/texmf-dist/doc/lualatex/ekdosis/ekdosis.el @@ -2,7 +2,7 @@ ;; This file is part of the `ekdosis' package ;; ekdosis -- TEI xml compliant critical editions -;; Copyright (C) 2020 Robert Alessi +;; Copyright (C) 2020--2021 Robert Alessi ;; Please send error reports and suggestions for improvements to Robert ;; Alessi <alessi@robertalessi.net> diff --git a/Master/texmf-dist/doc/lualatex/ekdosis/ekdosis.pdf b/Master/texmf-dist/doc/lualatex/ekdosis/ekdosis.pdf Binary files differindex 588e219534e..b3f66493573 100644 --- a/Master/texmf-dist/doc/lualatex/ekdosis/ekdosis.pdf +++ b/Master/texmf-dist/doc/lualatex/ekdosis/ekdosis.pdf diff --git a/Master/texmf-dist/doc/lualatex/ekdosis/samples/Caesar_BG-6-13-1.pdf b/Master/texmf-dist/doc/lualatex/ekdosis/samples/Caesar_BG-6-13-1.pdf Binary files differindex 4ffd23516b4..17f6b02a968 100644 --- a/Master/texmf-dist/doc/lualatex/ekdosis/samples/Caesar_BG-6-13-1.pdf +++ b/Master/texmf-dist/doc/lualatex/ekdosis/samples/Caesar_BG-6-13-1.pdf diff --git a/Master/texmf-dist/source/lualatex/ekdosis/Makefile b/Master/texmf-dist/source/lualatex/ekdosis/Makefile index 694b884d813..4479b82d096 100644 --- a/Master/texmf-dist/source/lualatex/ekdosis/Makefile +++ b/Master/texmf-dist/source/lualatex/ekdosis/Makefile @@ -11,6 +11,10 @@ SAMPLES := samples exts := md html ins dtx el findopts := $(foreach ext,$(exts),-or -iname "*.$(ext)") +define do_documentation + $(CMP) --shell-escape --recorder --interaction=nonstopmode $(NAME).dtx >/dev/null +endef + all: sty $(NAME).pdf testsamples: @@ -23,24 +27,26 @@ sty: clean $(NAME).pdf: testsamples $(NAME).dtx @ echo "Making the sample files first..." - $(MAKE) --directory=$(SAMPLES) - @ echo "Building the documentation of $(NAME)..." - $(CMP) --shell-escape --recorder --interaction=batchmode $(NAME).dtx >/dev/null - biber $(NAME) >/dev/null - $(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 - $(CMP) --shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null - 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 + @ $(MAKE) --directory=$(SAMPLES) >/dev/null + @ echo "Done making samples" + @ echo "Building the documentation of $(NAME) with $(CMP). Please be patient..." + @ $(do_documentation) + @ echo "Now calling biber" + @ biber $(NAME) >/dev/null + @ echo "Returning to $(CMP)..." + @ for run in {1..4}; do $(do_documentation); done + @ echo "Building indexes..." + @ 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 + @ echo "Final runs of $(CMP)..." + @ for run in {1..7}; do $(do_documentation); done + @ echo "Done" samples: clean sty $(MAKE) --directory=$(SAMPLES) clean: testsamples + @ echo "Cleaning $(NAME) directory" rm -rf auto rm -f $(NAME).bib $(PWD)/TMP/*.bib rm -rf .backup @@ -66,12 +72,14 @@ uninst: rm -rf $(HOMEDIR)/.emacs.d/auctex/auto/$(NAME).{el,elc} inst: uninst auctex all + @ echo "Installing $(NAME) locally" mkdir -p $(UTREE)/{tex,source,doc}/lualatex/$(NAME) cp $(NAME).dtx $(UTREE)/source/lualatex/$(NAME) cp $(NAME).sty $(UTREE)/tex/lualatex/$(NAME) cp $(NAME).lua $(UTREE)/tex/lualatex/$(NAME) cp $(NAME).pdf $(UTREE)/doc/lualatex/$(NAME) cp -r samples/ $(UTREE)/doc/lualatex/$(NAME) + @ echo "Installation complete. Happy TeXing!" local: uninst auctex $(CMP) $(NAME).ins diff --git a/Master/texmf-dist/source/lualatex/ekdosis/ekdosis.dtx b/Master/texmf-dist/source/lualatex/ekdosis/ekdosis.dtx index 10400c83965..229d7c1d142 100644 --- a/Master/texmf-dist/source/lualatex/ekdosis/ekdosis.dtx +++ b/Master/texmf-dist/source/lualatex/ekdosis/ekdosis.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % ekdosis -- Typesetting TEI xml-compliant critical editions -% Copyright (C) 2020 Robert Alessi +% Copyright (C) 2020--2021 Robert Alessi % % Please send error reports and suggestions for improvements to Robert % Alessi <alessi@robertalessi.net> @@ -28,7 +28,7 @@ This file is part of the `ekdosis' package ekdosis -- Typesetting TEI xml-compliant critical editions -Copyright (C) 2020 Robert Alessi +Copyright (C) 2020--2021 Robert Alessi Please send error reports and suggestions for improvements to Robert Alessi <alessi@robertalessi.net> @@ -61,7 +61,7 @@ along with this program. If not, see %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{ekdosis} %<*package> - [2020/11/04 v1.1 Typesetting TEI xml-compliant critical editions] + [2021/04/02 v1.2 Typesetting TEI xml-compliant critical editions] %</package> %<*driver> \begin{filecontents}[noheader,overwrite]{bibdata.xml} @@ -104,6 +104,103 @@ along with this program. If not, see </imprint> </monogr> </biblStruct> + <biblStruct type="book" xml:id="shGildon1710"> + <monogr> + <title level="m">Works of Mr. William Shakespeare</title> + <editor> + <forename>Charles</forename> + <surname>Gildon</surname> + </editor> + <imprint> + <biblScope unit="volume">17</biblScope> + <publisher>E. Curl and E. Sanders</publisher> + <date>1710</date> + </imprint> + </monogr> + </biblStruct> + <biblStruct type="book" xml:id="shGildon1714"> + <monogr> + <title level="m">Works of Mr. William Shakespeare</title> + <editor> + <forename>Charles</forename> + <surname>Gildon</surname> + </editor> + <edition>2</edition> + <imprint> + <biblScope unit="volume">17</biblScope> + <publisher>E. Curl and E. Sanders</publisher> + <date>1714</date> + </imprint> + </monogr> + </biblStruct> + <biblStruct type="book" xml:id="shSewell1725"> + <monogr> + <title level="m">Venus and Adonis, Tarquin and Lucrece, and Mr. Shakespeare's Miscellany Poems</title> + <editor> + <name>Sewell</name> + </editor> + <imprint> + <publisher>A. Bettesworth</publisher> + <date>1725</date> + </imprint> + </monogr> + </biblStruct> + <biblStruct type="book" xml:id="shEwing1771"> + <monogr> + <title level="m">Poems, containing I. Venus and Adonis... IV. Sonnets</title> + <author> + <forename>William</forename> + <surname>Shakespeare</surname> + </author> + <editor> + <forename>T.</forename> + <surname>Ewing</surname> + </editor> + <imprint> + <pubPlace>Dublin</pubPlace> + <date>1771</date> + </imprint> + </monogr> + </biblStruct> + <biblStruct type="book" xml:id="shHudson1856"> + <monogr> + <title level="m">Works of W. Shakespeare</title> + <editor> + <forename>H.N.</forename> + <surname>Hudson</surname> + </editor> + <imprint> + <pubPlace>Boston</pubPlace> + <publisher>Munroe</publisher> + <date>1856</date> + </imprint> + </monogr> + </biblStruct> + <biblStruct type="book" xml:id="shWalsh1908"> + <monogr> + <title level="m">Shakespeare's Complete Sonnets</title> + <editor> + <forename>C.M.</forename> + <surname>Walsh</surname> + </editor> + <imprint> + <date>1908</date> + </imprint> + </monogr> + </biblStruct> + <biblStruct type="book" xml:id="shButler1899"> + <monogr> + <title level="m">Shakespeare's Sonnets</title> + <editor> + <forename>Samuel</forename> + <surname>Butler</surname> + </editor> + <imprint> + <publisher>Fifield</publisher> + <date>1899</date> + </imprint> + </monogr> + </biblStruct> </listBibl> \end{filecontents} \begin{filecontents}[overwrite]{\jobname.bib} @@ -113,13 +210,12 @@ along with this program. If not, see xml}-Compliant Critical Editions and Highlighting Parallel Writings}, journaltitle = {Journal of Data Mining and Digital Humanities}, - date = 2020, - pubstate = {submitted}, + date = {2020-11}, issuetitle = {Collecting, Preserving, and Disseminating Endangered Cultural Heritage for New Understandings through Multilingual Approaches}, - eprinttype = {hal}, - eprint = {hal-02779803} + eprinttype = {jdmdh}, + eprint = {6536} } @Book{Caesar-BG-v2, @@ -146,6 +242,29 @@ along with this program. If not, see publisher = {Harper \& Brothers}, location = {New York}} +@MVBook{HomerMurray, + author = {{Homer}}, + title = {The Odyssey}, + date = 1919, + editor = {Murray, A.T\adddot}, + volumes = 2, + publisher = {Harvard University Press -- William Heinemann}, + location = {Cambridge, MA. -- London} +} + +@Book{McDonald1916, + editor = {MacDonald Alden, Raymond}, + shorteditor = {MacDonald}, + title = {The Sonnets of Shakespeare}, + date = 1916, + titleaddon = {From the Quarto of 1609 with Variorum Readings and + Commentary}, + organization = {Houghton Mifflin Co.}, + publisher = {The Riverside Press Cambridge}, + options = {useauthor=false, useeditor=true}, + location = {Boston \& New York} +} + @Book{ReynoldsWilson1991, author = {Reynolds, L. D. and Wilson, N. G}, title = {Scribes and Scholars}, @@ -192,6 +311,15 @@ along with this program. If not, see url = {http://www.teibyexample.org} } +@Software{extdash, + title = {The Extdash package}, + titleaddon = {A range of dash commands for compound words}, + author = {Rozhenko, Alexander I.}, + url = {http://www.ctan.org/pkg/extdash}, + date = {2018-06-24}, + version = {1.3} +} + @Software{fnpos, title = {The Fnpos package}, titleaddon = {Control the position of footnotes on the page}, @@ -210,6 +338,15 @@ along with this program. If not, see version = {4.41} } +@Software{memoir, + title = {The Memoir package}, + titleaddon = {Typeset fiction, non-fiction and mathematical books}, + author = {Madsen, Lars and Wilson, Peter R.}, + url = {http://www.ctan.org/pkg/memoir}, + date = {2021-03-23}, + version = {3.7o} +} + @Software{paracol, title = {The Paracol package}, titleaddon = {Multiple columns with texts “in parallel”}, @@ -237,6 +374,15 @@ along with this program. If not, see version = {3.47} } +@Software{verse, + title = {The Verse package}, + titleaddon = {Aids for typesetting simple verse}, + author = {Wilson, Peter R. and Robertson, Will}, + url = {http://www.ctan.org/pkg/verse}, + date = {2014-05-10}, + version = {2.4b} +} + @Software{arabluatex, title = {The Arabluatex package}, titleaddon = {ArabTeX for LuaLaTeX}, @@ -248,7 +394,7 @@ along with this program. If not, see @Software{icite, title = {The Icite package}, - subtitle = {Indices locorum citatorum}, + titleaddon = {Indices locorum citatorum}, author = {Alessi, Robert}, url = {http://ctan.org/pkg/icite}, date = {2020-03-05}, @@ -265,7 +411,7 @@ along with this program. If not, see version = {4.00} } \end{filecontents} -\begin{filecontents}[overwrite]{\jobname-cfg.tex} +\begin{filecontents}[overwrite]{\jobname-ekd.cfg} \footnotelayout{m} \EnvtoTEI{ancientgreek}{p}[xml:lang="grc"] \DeclareApparatus{fontium}[ @@ -350,6 +496,23 @@ along with this program. If not, see \DeclareWitness{sV}{V}{Vaticanus lat. 1652}[ origDate=s. XV] \DeclareSource{sDrak}{\emph{Drakenborch}} +% Homer, Odyssey +\DeclareScholar{hZen}{Zen.}[rawname=Zenodotus] +% Shakespeare's Sonnets: +\NewDocumentEnvironment{ekdcenter}{}{\par\centering}{\nobreak\par} +\NewDocumentCommand{\ekdlettrine}{mm}{% + \adjustbox{valign=t,raise=-0.75ex}{\Huge #1}\textsc{#2}% +} +\TeXtoTEIPat{\ekdlettrine {#1}{#2}}{<hi rend="smallcaps">#1#2</hi>} +\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 %</driver> % \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 %</example> % \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 %</example> % \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 |<msIdentifer>| element in the \texttt{TEI} -% header:---\footnote{See +% header:\footnote{See % \url{https://tei-c.org/release/doc/tei-p5-doc/en/html/MS.html\#msid} -% for detailed information on these elements.}\\ +% for detailed information on these elements.}---\\ % \DescribeOption{settlement} |settlement|$=$\meta{name}: The name of % a city or administrative unit.\\ % \DescribeOption{institution} |institution|$=$\meta{name}: The name @@ -1083,7 +1278,7 @@ along with this program. If not, see % \DescribeOption{origDate} |origDate|$=$\meta{date}: Any form of date % used to identify the date of origin for the witness. % -% \label{ref:marcianus-b} +% \phts\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 transmitted under the name @@ -1190,10 +1385,10 @@ along with this program. If not, see % \iffalse %</example> % \fi -% \label{ref:marcianus-e} +% \phts\label{ref:marcianus-e} % % \paragraph{Sources} -% \label{ref:declare-source} +% \phts\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 @@ -1230,10 +1425,10 @@ along with this program. If not, see % \iffalse %</example> % \fi -% \label{sec:declarations-end} +% \phts\label{sec:declarations-end} % % \paragraph{Scholars} -% \label{ref:declare-scholar} +% \phts\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 @@ -1292,9 +1487,9 @@ along with this program. If not, see % and N, and β, which includes mss.\ T, f, U and l. Therefore, % provided that all these witnesses have been already declared, here % is how the two families α and β could be -% declared:---\footnote{These witnesses are used in the example -% provided below in \vref{lst:caesar-bg}.} -% \label{ref:caesar-bg-sigla} +% declared:\footnote{These witnesses are used in the example +% provided below in \vref{lst:caesar-bg}.}--- +% \phts\label{ref:caesar-bg-sigla} % \iffalse %<*example> % \fi @@ -1425,7 +1620,7 @@ along with this program. If not, see % % \paragraph{Apparatus Entries} % \DescribeMacro{\app} \cs{app}|[type=|\meta{type}|]|\marg{apparatus -% entries}\label{ref:app-cmd}\\ +% entries}\phts\label{ref:app-cmd}\\ % This command takes one mandatory argument and accepts one optional % argument. Once references to be used as witnesses in the apparatus % criticus have been declared in the preamble as described in @@ -1450,7 +1645,7 @@ yesterday. %</example> % \fi % \cs{app} accepts one further optional argument:---\\ -% \DescribeOption{type} |type|$=$\meta{type}\label{ref:app-type} +% \DescribeOption{type} |type|$=$\meta{type}\phts\label{ref:app-type} % \hfill\tcboxverb{Default: default}\\ % As will be described below in \vref{sec:multilayer-apparatus}, % \pkg{ekdosis} initially sets one layer of notes\--- the |default| @@ -1478,31 +1673,31 @@ yesterday. % \enquote{source} and \enquote{scholar} as defined above % \vpageref{sec:terminology}. % -% \paragraph{Lemmata} \label{ref:lemmata}\DescribeMacro{\lem} +% \paragraph{Lemmata} \phts\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 % the edition text and as the first part of a new entry in the % apparatus criticus, preceded by the line number where it occurs or a -% broad space if the entry refers to the same line as the preceding -% entry. \label{ref:lem-opts-b}The optional argument of \cs{lem} +% broad space when the entry refers to the same line as the preceding +% entry. \phts\label{ref:lem-opts-b}The optional argument of \cs{lem} % accepts the following % comma-separated list of \enquote{name$=$value} arguments:---\\ % \DescribeOption{wit} |wit|$=$\meta{csv list of -% witnesses}\label{ref:lem-wit}\\ +% witnesses}\phts\label{ref:lem-wit}\\ % 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}|. Although any unique identifiers or +% |wit={A,B,C}|. \phts\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]\\ +% sources}\phts\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 @@ -1510,7 +1705,7 @@ yesterday. % 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]\\ +% scholars}\phts\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 @@ -1532,21 +1727,19 @@ yesterday. % bracket (|]|)\\ % \DescribeOption{nosep} |nosep|$=$\verb+true|false+\\ % This named argument does not need a value as it defaults to |true| -% 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.\\ +% if 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| be 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 -% related +% if used. |nolem| completely removes the lemma text from the related % entry in the apparatus criticus.\\ % \DescribeOption{type} |type|$=$\meta{value}\\ % This named argument has no effect on the apparatus criticus of the @@ -1573,7 +1766,7 @@ yesterday. % |prewit| inserts \meta{words} \emph{before} the list of witnesses.\\ % \DescribeOption{postwit} |postwit|$=$\meta{words}\pointtor{postwit}\\ % |postwit| inserts \meta{words} \emph{after} the list of witnesses. -% \label{ref:lem-opts-e} +% \phts\label{ref:lem-opts-e} % % \paragraph{Readings} \DescribeMacro{\rdg} % \cs{rdg}\oarg{options}\marg{variant reading}\\ @@ -1589,13 +1782,13 @@ yesterday. % provided above \vpagerefrange{ref:lem-opts-b}{ref:lem-opts-e} for % more detailed information:---\\ % \DescribeOption{wit} |wit|$=$\meta{csv list of -% witnesses}\label{ref:rdg-wit}\\ +% witnesses}\phts\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| -% if it is used. |nordg| completely removes the variant reading from +% if 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 @@ -1607,15 +1800,15 @@ yesterday. % \DescribeOption{postwit} |postwit|$=$\meta{words}\\ % % \paragraph{Notes} -% \DescribeMacro{\note}\label{ref:notes-b}\DescribeMacro{\note*} +% \DescribeMacro{\note}\phts\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 +% \cs{note*}\oarg{options}\marg{text}\phts\label{ref:editorial-notes}\\ +% It may happen that editorial notes are needed to record short % comments of general nature \emph{between} lemmata and % readings. \cs{note} inserts inline comments while \cs{note*} places % comments below the entire apparatus block. Furthermore, if -% \pkg{ekdosis} has been loaded with the |parnotes| option as -% described above \vpageref{ref:parnotes-opt}, \cs{note*} will use the +% \pkg{ekdosis} be loaded with the |parnotes| option as described +% above \vpageref{ref:parnotes-opt}, \cs{note*} will use the % \pkg{parnotes} package to lay out the notes as an additional % paragraph below the apparatus criticus. The optional argument of % \cs{note}/\cs{note*} accepts the following comma-separated list of @@ -1759,7 +1952,7 @@ yesterday. % \iffalse %</example> % \fi -% \label{ref:notes-e} +% \phts\label{ref:notes-e} % % \subsection{Indicating Subvariation in Apparatus Entries} % \label{sec:indic-subv-appar} @@ -1937,7 +2130,7 @@ friend % 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 +% edition text. A conjecture is called an \enquote{emendation} when 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>| @@ -2025,7 +2218,7 @@ friend % |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 +% \item \phts\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 @@ -2075,7 +2268,7 @@ friend % \end{alignment} % % \texttt{TEI xml} output:--- -% +% \enlargethispage{\baselineskip} % \iffalse %<*example> % \fi @@ -2111,7 +2304,7 @@ friend % \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. +% only one word be suspect, only one crux is needed. % \end{description} % % \DescribeMacro{\SetCritSymbols}\newfeature[v1.1] @@ -2163,7 +2356,7 @@ friend % \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@rlmode| which is evaluated as |true| if the -% writing direction is set from right to left and as |false| +% writing direction be set from right to left and as |false| % otherwise. As the \pkg{etoolbox} package is loaded by \pkg{ekdosis}, % \cs{ifboolean}|{al@rlmode}|\marg{rtl symbol}\marg{ltr symbol} can be % used to perform the test. @@ -2246,7 +2439,7 @@ friend \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[nordg, source=Gal]{\arb{al-.hummayAti}} \rdg[wit=codd, source=edd, alt=om.]{} }, \end{ekdosis} @@ -2283,7 +2476,7 @@ friend % \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[nordg, source=Gal]{\arb{al-.hummayAti}} % \rdg[wit=hcodd, source=hedd, alt=om.]{} % }, % \end{specimen} @@ -2325,7 +2518,7 @@ friend <ref target="#Gal">Gal.</ref>)</note> <rdg source="#Gal"> <foreign xml:lang="ar-Latn" type="transliterated" - subtype="arabtex">^gamI`a 'l-.hummayAti</foreign> + subtype="arabtex">al-.hummayAti</foreign> </rdg> <rdg wit="#V #I #R #H" source="#Lit #Erm #Sm" /> </app>,</p> @@ -2351,7 +2544,7 @@ friend % % \paragraph{The \env{alignment} Environment} % \DescribeEnv{alignment} \cs{begin}|{alignment}|\oarg{options}\dots -% \cs{end}|{alignment}|\label{ref:alignment-syntax}\\ +% \cs{end}|{alignment}|\phts\label{ref:alignment-syntax}\\ % This environment can be used as it is provided to typeset a standard % critical edition, namely an edition text, equipped with an apparatus % criticus and laid out on the left-hand pages, accompanied by a @@ -2387,12 +2580,13 @@ friend %</example> % \fi % -% \DescribeEnv{edition*}\DescribeEnv{translation*} -% \label{ref:starred-envs} Furthermore, so-called \enquote{starred} -% versions of these environments can be used at any point to -% synchronize texts, that is to print them in such a way that the tops -% of all paragraphs are vertically aligned. To that effect, it must be -% noted that merely applying this command on a single +% \DescribeEnv{edition*} +% \DescribeEnv{translation*} +% \phts\label{ref:starred-envs} Furthermore, so-called +% \enquote{starred} versions of these environments can be used at any +% point to synchronize texts, that is to print them in such a way that +% the tops of all paragraphs are vertically aligned. To that effect, +% it must be noted that merely applying this command on a single % environment\---for instance the leftmost one\---will have all other % associated paragraphs printed aligned. % @@ -2403,8 +2597,7 @@ friend % encoding allows not to lose sight of paragraphs that are meant to be % read together, but it is also the only way to align paragraphs in % print, and it is much more suitable to mark up correspondence -% between spans of texts as will be demonstrated below in -% \vref{ref:segmentation}. +% between spans of texts. % % As an illustration, a short extract of Caesar's \emph{Gallic War}, % VI, XIII.1 follows.\footnote{Latin text: \cite{Caesar-BG-v2}; @@ -2455,6 +2648,7 @@ friend %</example> % \fi % +% \begingroup % \needspace{7\baselineskip} % \resetlinenumber % \FormatDiv{2}{}{.} @@ -2488,6 +2682,7 @@ friend % and is admitted to no deliberation. % \end{translation} % \end{alignment} +% \endgroup % % \begin{remarks} % \item As can be seen from the apparatus entry related to l.~4 above, @@ -2505,6 +2700,7 @@ friend % \end{remarks} % % Finally, the corresponding \texttt{TEI xml} output follows:--- +% % \iffalse %<*example> % \fi @@ -2590,7 +2786,7 @@ friend % \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 \label{it:lang-subopt} Each name may be followed by a +% \item \phts\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 @@ -2642,7 +2838,7 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ % \DescribeOption{paired} |paired|$=$\verb+true|false+% % \hfill\tcboxverb{Default: true (initially not set)}\\ % This named argument does not need a value as it defaults to |true| -% if it is used. By default, \pkg{ekdosis} follows the \LaTeX{} page +% if used. By default, \pkg{ekdosis} follows the \LaTeX{} page % numbering scheme when multiple texts are arranged on facing % pages. The |paired| option leaves every right-hand page number % unchanged, so that both facing pages hold the same page number.\\ @@ -2655,7 +2851,7 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ % \DescribeOption{flush} |flush|$=$\verb+true|false+ % \hfill\tcboxverb{Default: false}\\ % This named argument does not need a value as it defaults to |true| -% if it is used. This option applies when two or more distinct +% if used. This option applies when two or more distinct % \env{alignment} environments are started on the same page. Should % this happen, any subsequent \env{alignment} environment must be set % with the |flush| option so that every one of them carry its own @@ -2696,9 +2892,9 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ % % \DescribeMacro{\SetAlignment} % \cs{SetAlignment}\marg{alignment settings}\\ -% If the same alignment settings are to be shared by several -% \env{alignment} environments, common settings can be collected in -% the argument of \cs{SetAlignment}, like +% If the same alignment settings be shared by several \env{alignment} +% environments, common settings can be collected in the argument of +% \cs{SetAlignment}, like % so:---\\ % \iffalse %<*example> @@ -2871,8 +3067,9 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ % 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} +% notes. The respective places of these blocks 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} @@ -2883,9 +3080,9 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ % the apparatus criticus (e.g. sources, testimonia, variant readings % \emph{\&c.}) % -% \DescribeMacro{\SetHooks} -% \cs{SetHooks}\marg{csv list of hooks} can be used either in -% the preamble or at any point of the document. The list of accepted +% \DescribeMacro{\SetHooks} \cs{SetHooks}\marg{csv list of hooks} can +% be used either in the preamble or at any point of the document. The +% list of accepted % hooks at the time of writing follows:---\\ % \DescribeOption{appfontsize} |appfontsize|$=$\meta{command} % \hfill\tcboxverb{Default: \footnotesize}\\ @@ -2898,8 +3095,8 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ % font used to print references to line numbers in the apparatus % criticus. By default, numbers are printed in bold face. As an % example, |refnumstyle=\normalfont| will have them printed in the -% font and shape selected by default for the -% document, while |refnumstyle=\bfseries\itshape| will have them +% font and shape selected by default for the document, while +% |refnumstyle=\bfseries\itshape| will have them % printed in bold and italic.\\ % \DescribeOption{postrefnum} |postrefnum|$=$\meta{command \textbar\ % chars}\hfill\tcboxverb{Default: ~}\\ @@ -2907,7 +3104,33 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ % reference to line numbers. By default, it is |~|, namely an % unbreakable space. As an example, |postrefnum=\hskip 0.5em| will % insert a \unit[0.5]{em} space between the numerals and the beginning -% of all subsequent notes. +% of all subsequent notes.\\ +% \DescribeOption{lemmastyle} |lemmastyle|$=$\meta{command} +% \hfill\tcboxverb{Default: not set}\\ +% \newfeature[v1.2] |lemmastyle| can be used to set the family, series +% or shape of the font used to print lemma texts in the apparatus +% criticus. For example, |lemmastyle=|\cs{bfseries} will print all +% instances of lemma text in bold while +% |lemmastyle=|\cs{color}|{blue}| will print them in blue. +% \DescribeOption{readingstyle} |readingstyle|$=$\meta{command} +% \hfill\tcboxverb{Default: not set}\\ +% \newfeature[v1.2] |readingstyle| operates in the same way as +% |lemmastyle| but applies to variant readings.\\ +% \DescribeOption{initialrule} |initialrule|$=$\meta{command} +% \phts\label{ref:initialrule}\hfill\bgroup\footnotesize +% \tcboxverb{Default: \rule{0.4\columnwidth}{0.4pt} (initially not set)}% +% \egroup +% \newfeature[v1.2] |initialrule| draws a separating rule between the +% edition text and all subsequent layers of critical notes. Of course, +% this option only makes sense when multiple-layer apparatus criticus +% are set. Therefore, it has no effect on single-layer apparatus +% criticus.\\ +% \DescribeOption{noinitialrule}\hfill\tcboxverb{Default: not set}\\ +% This is a no-value option. It removes any previously set +% |initialrule|. +% +% An example of the way these hooks may be used is provided below in +% \vref{lst:shak-sonnet1}. % % \subsection{Single-Layer Apparatus Criticus} % \label{sec:single-layer-app} @@ -2936,13 +3159,12 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ % block, while |\SetBeginApparatus{\hskip 1em}| will set an % indentation of one em. % -% \DescribeMacro{\SetEndApparatus} -% \label{ref:setendapparatus} +% \DescribeMacro{\SetEndApparatus}\phts\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. \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 +% nothing is appended. \phts\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.} % @@ -2962,9 +3184,15 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ % document to change the default setting. Leaving this argument empty % as in \cs{SetDefaultRule}|{}| removes the line. % +% \DescribeMacro{\SetApparatusLanguage} +% \phts\label{ref:app-lang}\newfeature[v1.2] +% \cs{SetApparatusLanguage}\marg{languagename} can be used when it is +% needed to apply in the apparatus criticus a language different from +% the one that is selected in the edition text. +% % \paragraph{General Command} % \DescribeMacro{\SetApparatus} \cs{SetApparatus}\marg{csv list of -% apparatus settings}\label{ref:apparatus-settings-b}\\ +% apparatus settings}\phts\label{ref:apparatus-settings-b}\\ % Finally, all the settings described above can also be collected in % the argument of \cs{SetApparatus}. \cs{SetApparatus} accepts the % following list of comma-separated |key=value| options:---\\ @@ -2994,14 +3222,23 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ % also be used to remove the line.\\ % \DescribeOption{norule}\hfill\tcboxverb{Default: not set}\\ % |norule| does not accept any value and has the same effect as -% |rule=none|.\label{ref:apparatus-settings-e} -% +% |rule=none|.\phts\label{ref:apparatus-settings-e}\\ +% \DescribeOption{lang} |lang|$=$\meta{languagename} +% \newfeature[v1.2]\phts\label{ref:app-lang-opt} +% \hfill\tcboxverb{Default: not set}\\ +% \needspace{3\baselineskip}\noindent +% |lang=<languagename>| is used as described +% \vpageref[above]{ref:app-lang} when it is needed to apply in the +% apparatus criticus a language different from the one that is +% selected in the edition text. |languagename| can be any value +% accepted by \pkg{babel} or \pkg{polyglossia}. +% % As an example, an apparatus criticus with references to line numbers % printed in normal font, a colon as a separator between lemma texts % and variant readings, a broad space as a delimiter between entries % and a \unit[0.7]{in} line above could be laid out as follows:--- % -% \label{ex:single-layer-app-layout} +% \phts\label{ex:single-layer-app-layout} % \iffalse %<*example> % \fi @@ -3044,7 +3281,7 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ % internally. If any additional layer of notes be declared in the % preamble, this |default| layer must be included in the list of % declared layers.\\ -% \DescribeMacro{\SetDefaultApparatus}\label{ref:ekd-default-app} +% \DescribeMacro{\SetDefaultApparatus}\phts\label{ref:ekd-default-app} % \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}. @@ -3089,6 +3326,7 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ % \DescribeOption{ehook} % \DescribeOption{rule} % \DescribeOption{norule} +% \DescribeOption{lang}\phts\label{ref:apps-lang-opt} % With regard to layout, any declared layer inherits the default values % described above in \vref{sec:single-layer-app}. That said, as the % optional argument of \cs{DeclareApparatus} accepts the exact same @@ -3107,27 +3345,39 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ % \iffalse %<*example> % \fi -\begin{minted}[linenos=false]{latex} +\begin{minted}{latex} \SetHooks{ - refnumstyle=\normalfont + refnumstyle=\normalfont, + initialrule=\rule{0.7in}{0.4pt} } \DeclareApparatus{testium}[ sep={] }, delim=\hskip 1em, - rule=\rule{0.7in}{0.4pt} + norule ] \DeclareApparatus{default}[ sep={: }, delim=\hskip 1em, - norule + rule=\relax ] \end{minted} % \iffalse %</example> % \fi -% +% +% \begin{remarks} +% \item The general hook \texttt{initialrule} used here (l.~3) is +% described above \vpageref{ref:initialrule}. +% \item \cs{relax} (l.~13) is a \TeX\ primitive that instructs to do +% nothing. Therefore, |rule=\relax| is not strictly equivalent to +% |norule|: with the former, \cs{relax} removes the rule but leaves +% untouched the subsequent carriage return: as a result, the layers +% are visually separated from one another by a blank line. With the +% latter everything is removed, carriage return included. +% \end{remarks} +% % \paragraph{Limiting the Number of Entries per Page} -% \label{ref:maxentries} +% \phts\label{ref:maxentries} % In some instances, it can be useful to set a limit to the number of % entries per page that a given layer of critical notes may accept, % notably when entries are so abundant in number that \pkg{ekdosis} @@ -3141,7 +3391,7 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ % the apparatus criticus this option is related to. As a result, the % page will actually break at the end of the current line. The % particulars of this technique will be discussed below in -% \vref{sec:tricks-of-trade}. +% \vref{sec:oscillating-problem}. % % \section{Inserting Notes in Multiple-Layer Apparatus} % \label{sec:notes-in-multilayer-app} @@ -3184,7 +3434,7 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ %</example> % \fi % -% If one wishes to refer to |rec1| as the default layer, then +% Should one wish to refer to |rec1| as the default layer, then % \cs{SetDefaultApparatus} must be used, like so:--- % % \iffalse @@ -3223,7 +3473,7 @@ Some \app[type=rec2]{ % \fi % % \danger At any rate, |type=default| or |type=rec1|, depending on -% what has been chosen, must be used if the editor wishes to retain +% what has been chosen, must be used should the editor wish to retain % that information in the \texttt{TEI xml} output file. % % \subsection{Other Notes for Comments, Sources or Testimonia} @@ -3262,7 +3512,7 @@ Some \app[type=rec2]{ % The separator between the lemma text and the contents of the note.\\ % \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 +% if used. Obviously, |nosep| removes the separator mentioned % above.\\ % \DescribeOption{lem} |lem|$=$\meta{lemma text}\\ % |lem| is the span of text the note is about. It may consist of one @@ -3278,8 +3528,8 @@ Some \app[type=rec2]{ % \DescribeOption{labele} |labele|$=$\meta{label}\\ % |labele| is the unique label to serve as a reference for the point % immediately following the lemma text. Contrary to |labelb|, |labele| -% may be left unspecified if the note is only about one word. If it is -% about a span, then |labele| ought to be specified.\\ +% may be left unspecified if the note be only about one word. If the +% note be about a span, then |labele| must be specified.\\ % \DescribeMacro{\linelabel} \cs{linelabel}\marg{label}\\ % If |labele|$=$\meta{some\_label} be specified in the optional % argument of \cs{note}, \cs{linelabel}\marg{some\allowbreak\_label} @@ -3366,12 +3616,12 @@ the American Continent</emph>, II.61--2.</note></p> % \fi % % \paragraph{\cs{note} or \cs{linelabel} inside \cs{lem}} -% It may happen that \cs{note} or \cs{linelabel} commands be found -% inside the argument of \cs{lem}. Obviously, inserting such commands +% It may happen that the \cs{note} or \cs{linelabel} command is found +% inside the argument of \cs{lem}. Obviously, inserting such a command % in the apparatus criticus in print makes no sense and will lead to % an error. The solution is to insert in the value of the |alt| % optional argument of \cs{lem} a duplicate of the lemma text devoid -% of those commands, like so:--- +% of that command, like so:--- % % \iffalse %<*example> @@ -3379,7 +3629,7 @@ the American Continent</emph>, II.61--2.</note></p> \begin{minted}[linenos=false]{latex} This is some \app{ \lem[alt=dummy]{\note[type=fontium, labelb=bnote, labele=enote, - lem=dummy... command]{Text of the note} + lem=dummy... command]{Text of the note.} dummy} \rdg{pseudo}} text to demonstrate how to insert a note in the argument of the @@ -3398,7 +3648,7 @@ text to demonstrate how to insert a note in the argument of the % \begin{specimen} % This is some \app{ % \lem[alt=dummy]{\note[type=fontium, labelb=bnote, labele=enote, -% lem=dummy... command]{Text of the note} +% lem=dummy... command]{Text of the note.} % dummy} % \rdg{pseudo}} % text to demonstrate how to insert a note in the argument of the @@ -3418,7 +3668,7 @@ text to demonstrate how to insert a note in the argument of the <anchor xml:id="bnote" />dummy</lem> <note type="fontium" target="#range(right(bnote),left(enote))">Text of the - note</note> + note.</note> <rdg>pseudo</rdg> </app>text to demonstrate how to insert a note in the argument of the @@ -3436,6 +3686,697 @@ argument of the % element (ll.~5--7). Otherwise, the \texttt{TEI} output would not be % valid. % +% \section{Poetry} +% \label{sec:poetry} +% \subsection[The Standard \textsf{verse} Environment]{The Standard +% \env{verse} Environment} +% \label{sec:stand-verse-env} +% +% In order to typeset verse texts or poems, \LaTeX\ provides the +% standard \env{verse} environment. Within this environment, |\\| is +% normally used to end lines, with the exception of the last line. As +% a result, stanzas are separated from one another by a blank line. +% +% \pkg{ekdosis} provides \env{ekdverse} which is recommended for use +% in place of the standard \env{verse} environment. By default, +% \env{ekdverse} produces the same result as \env{verse}. However, +% \pkg{ekdosis} deviates a little from the standard usage for it needs +% all lines of poetry to be ended by |\\| as a distinct marker. In the +% following listing, stanzas are visually separated from one another +% by an additional vertical space of \unit[2]{ex} (l.~5). Between +% stanzas, |%| is used to prevent \TeX\ from +% introducing a blank line. But a blank line\===or even no blank +% line\===would produce the exact same result:--- +% +% \iffalse +%<*example> +% \fi +\begin{minted}{latex} +\begin{ekdverse} + It is an ancient Mariner,\\ + And he stoppeth one of three.\\ + ‘By thy long grey beard and glittering eye,\\ + Now wherefore stopp'st thou me?\\[2ex] + % + The Bridegroom's doors are opened wide,\\ + And I am next of kin;\\ + The guests are met, the feast is set:\\ + May'st hear the merry din.’\\ +\end{ekdverse} +\end{minted} +% \iffalse +%</example> +% \fi +% +% PDF output:--- +% \medskip +% \SetLineation{vmodulo=0} +% \begingroup +% \needspace{7\baselineskip} +% \resetlinenumber\resetvlinenumber +% \begin{alignment}[flush,tcols=1,texts=coleridge,apparatus=coleridge] +% \begin{coleridge} +% \begin{verse} +% It is an ancient Mariner,\\ +% And he stoppeth one of three.\\ +% ‘By thy long grey beard and glittering eye,\\ +% Now wherefore stopp'st thou me?\\[2ex] +% +% The Bridegroom's doors are opened wide,\\ +% And I am next of kin;\\ +% The guests are met, the feast is set:\\ +% May'st hear the merry din.’\\ +% \end{verse} +% \end{coleridge} +% \end{alignment} +% \endgroup +% \SetLineation{vmodulo=1} +% \medskip +% +% \indent\texttt{TEI xml} output:--- +% +% \iffalse +%<*example> +% \fi +\begin{minted}[linenos=false]{xml} +<lg> + <l>It is an ancient Mariner,</l> + <l>And he stoppeth one of three.</l> + <l>‘By thy long grey beard and glittering eye,</l> + <l>Now wherefore stopp'st thou me?</l> + <l>The Bridegroom's doors are opened wide,</l> + <l>And I am next of kin;</l> + <l>The guests are met, the feast is set:</l> + <l>May'st hear the merry din.’</l> +</lg> +\end{minted} +% \iffalse +%</example> +% \fi +% +% One would have expected here the |<lg>| element to be used as +% delimiter to encode the stanzaic verse forms. But as can be seen, +% only the outermost level of line group has been converted into +% \texttt{TEI xml}, let alone the vertical spacing between stanzas +% which has been ignored. This is because it is about as much as the +% standard \env{verse} environment provides. +% +% \subsection[The \textsf{verse} Package]{The \pkg{verse} Package} +% \label{sec:verse-package} +% \newfeature[v1.2] +% \pkg{ekdosis} can use the facilities offered by the excellent +% \pkg{verse} package\footcite{verse} to which it adds a specific +% environment for the encoding of line groups such as +% stanzas. Furthermore, as the \pkg{verse} package provides its own +% numbering mechanism, the lines can be numbered independently of +% prose text.\footnote{See \vpageref{ref:verse-lineation} for +% details.} +% +% \danger For what is described in this section to operate, +% \pkg{ekdosis} must be loaded with the global option |poetry=verse| +% as explained above \vpageref{ref:poetry-opt}. Simply loading the +% \pkg{verse} package by means of \cs{usepackage} will have no effect. +% +% \danger The foregoing does not apply if the \cls{memoir} class be +% used.\footcite{memoir} In this case, \pkg{ekdosis} automatically +% uses the code provided by this class without the need to set +% the global option |poetry=verse|. +% +% \paragraph{Compatible Verse Commands} +% The reader is invited to refer to the documentation of the +% \env{verse} package for detailed information. Within the +% \env{ekdverse} environment, |\\| \emph{must be used} at the end of +% each line, as follows:--- +% \begin{enumerate} +% \item |\\| is the standard command to be used at the end of each +% line. +% \item |\\!| must be used at the end of stanzas or line groups +% instead of |\\|. +% \item |\\*| does the same as |\\| except that it prohibits a page +% break after the line. +% \item |\\>| is for line breaks within a verse line. +% \end{enumerate} +% +% All of these commands can take a dimension as optional argument, +% like so: |\\[30pt]|, |\\![30pt]|, |\\*[30pt]| or |\\>[30pt]|. If +% |\\|, |\\!| or |\\*| be used, a vertical space of the dimension +% specified is added between lines, whereas |\\>[...]| adds an +% horizontal space after the line break. +% +% \DescribeMacro{\vin} \phts\label{ref:verse-vin}\cs{vin} indents a +% verse line by a length which is by default \unit[1.5]{em}. This +% length is stored as \cs{vgap} and can be changed by \cs{setlength} +% or \cs{addtolength}. +% +% \paragraph{The \env{ekdverse} Environment} +% \DescribeEnv{ekdverse} \cs{begin}|{ekdverse}|\oarg{options} \dots\ +% \cs{end}|{ekdverse}|\phts\label{ref:ekdverse-syntax}\\ +% This environment is used to hold verse lines as described above and +% may receive an optional argument in which the following +% \enquote{name$=$value} arguments are accepted:---\\ +% \DescribeOption{width} |width|$=$\meta{length} +% \hfill\tcboxverb{Default: \linewidth}\\ +% If |width| be supplied, it is taken as a length in relation to which +% the entire contents of the environment is to be horizontally +% centered. If given, this dimension may correspond to an average line +% or to the longest line of the line group. To this end, the standard +% \LaTeX\ command \cs{settowidth} can be used, like so:--- % +% \iffalse +%<*example> +% \fi +\begin{minted}[linenos=false]{latex} +\settowidth{\versewidth}{This is the average line,} +\begin{ekdverse}[width=\versewidth] +... +\end{ekdverse} +\end{minted} +% \iffalse +%</example> +% \fi % +% \begin{remarks} +% \item[\textsc{Rem.}] \cs{versewidth} is provided by the \env{verse} +% package as a convenience and can be used by \env{ekdosis}. +% \end{remarks} +% \DescribeOption{type} |type|$=$\meta{type} +% \hfill\tcboxverb{Default: not set}\\ +% This named argument is used in the \texttt{TEI xml} output to +% name the type of unit encoded within the |<lg>| element, viz.\ +% \enquote{sonnet}, \enquote{quatrain}, \enquote{couplet} and the +% like. +% +% \danger Unlike the \texttt{TEI xml} element |<lg>|, \env{ekdverse} +% may not nest hiearchichally. Within this environment, +% \env{ekdstanza} must be used instead to encode stanzas as described +% \vpageref[below][below]{ref:ekdstanza}. +% +% As an example, the first five lines of Homer's \emph{Odyssey} could +% be encoded like so:\footcite{HomerMurray}--- +% +% \iffalse +%<*example> +% \fi +\begin{minted}[linenos=false]{latex} +\begin{alignment}[tcols=2, + lcols=2, + texts=homer[xml:lang="grc"];murray[xml:lang="en"], + apparatus=homer] + \begin{homer} + \begin{ekdverse} + Ἄνδρα μοι ἔννεπε, Μοῦσα, πολύτροπον, ὃς μάλα πολλὰ \\ + πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν· \\ + πολλῶν δ' ἀνθρώπων ἴδεν ἄστεα καὶ + \app{\lem{νόον} + \rdg[resp=Zen]{νόμον} + \note{Cf. Schol.}} ἔγνω, \\ + πολλὰ δ' ὅ γ' ἐν πόντῳ πάθεν ἄλγεα ὃν κατὰ θυμόν, \\ + ἀρνύμενος ἥν τε ψυχὴν καὶ νόστον ἑταίρων. \\ + \end{ekdverse} + \end{homer} + \begin{murray} + Tell me, O Muse, of the man of many devices, who wandered full + many ways after he had sacked the sacred citadel of Troy. Many + were the men whose cities he saw and whose mind he learned, aye, + and many the woes he suffered in his heart upon the sea, seeking + to win his own life and the return of his + comrades. + \end{murray} +\end{alignment} +\end{minted} +% \iffalse +%</example> +% \fi +% +% PDF output:--- +% \medskip +% \begingroup +% \setcolumnwidth{0.6\textwidth} +% \setlength{\leftmargini}{0em} +% \needspace{7\baselineskip} +% \resetlinenumber\resetvlinenumber +% \begin{alignment}[flush, +% lcols=2, +% texts=homer[xml:lang="grc"];murray[xml:lang="en"], +% apparatus=homer] +% \AtBeginEnvironment{homer}{\selectlanguage{greek}} +% \setlength{\vrightskip}{0.25em} +% \begin{homer} +% \begin{ekdverse} +% Ἄνδρα μοι ἔννεπε, Μοῦσα, πολύτροπον, ὃς μάλα πολλὰ \\ +% πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν· \\ +% πολλῶν δ' ἀνθρώπων ἴδεν ἄστεα καὶ +% \app{\lem{νόον} +% \rdg[resp=hZen]{νόμον} +% \note{Cf. Schol.}} ἔγνω, \\ +% πολλὰ δ' ὅ γ' ἐν πόντῳ πάθεν ἄλγεα ὃν κατὰ θυμόν, \\ +% ἀρνύμενος ἥν τε ψυχὴν καὶ νόστον ἑταίρων. \\ +% \end{ekdverse} +% \end{homer} +% \begin{murray} +% Tell me, O Muse, of the man of many devices, who wandered full +% many ways after he had sacked the sacred citadel of Troy. Many +% were the men whose cities he saw and whose mind he learned, aye, +% and many the woes he suffered in his heart upon the sea, seeking +% to win his own life and the return of his comrades. +% \end{murray} +% \end{alignment} +% \endgroup +% \medskip +% +% \texttt{TEI xml} output:--- +% +% \iffalse +%<*example> +% \fi +\begin{minted}[linenos=false]{xml} +<div xml:id="div-homer_1" xml:lang="grc"> + <lg> + <l>Ἄνδρα μοι ἔννεπε, Μοῦσα, πολύτροπον, ὃς μάλα πολλὰ</l> + <l>πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·</l> + <l>πολλῶν δ' ἀνθρώπων ἴδεν ἄστεα καὶ + <app> + <lem>νόον</lem> + <rdg resp="#Zen">νόμον</rdg> + <note>Cf. Schol.</note> + </app>ἔγνω,</l> + <l>πολλὰ δ' ὅ γ' ἐν πόντῳ πάθεν ἄλγεα ὃν κατὰ θυμόν,</l> + <l>ἀρνύμενος ἥν τε ψυχὴν καὶ νόστον ἑταίρων.</l> + </lg> +</div> +<div xml:id="div-murray_1" xml:lang="en"> + <p>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.</p> +</div> +\end{minted} +% \iffalse +%</example> +% \fi +% +% \paragraph{Stanzas} +% As can be seen above, the \LaTeX\ \env{ekdverse} environment is +% translated into the \texttt{TEI xml} |<lg>| element. The |type| +% attribute may then be used to name the type of unit encoded by this +% element. +% +% \DescribeEnv{ekdstanza} \cs{begin}|{ekdstanza}|\oarg{options} \dots\ +% \cs{end}|{ekdstanza}| \phts\label{ref:ekdstanza}\\ +% This environment is used within \env{ekdverse} to encode succeeding +% stanzaic forms. Within \env{ekdstanza}, the last line is ended by +% |\\!| or |\\| depending on whether an additional vertical space is +% required between stanzas. This environment may receive an optional +% argument in which the following \enquote{name$=$value} argument is +% accepted:---\\ +% \DescribeOption{type} |type|$=$\meta{type} +% \hfill\tcboxverb{Default: not set}\\ +% As in the case of \env{ekdverse}, this named argument is used in the +% \texttt{TEI xml} output to name the type of unit encoded within the +% |<lg>| element, viz.\ \enquote{quatrain}, \enquote{couplet} and the +% like. +% +% \paragraph{Indentation Patterns} +% \pkg{ekdosis} can use the \env{patverse} environment and its +% associated command \cs{indentpattern} that are provided by the +% \pkg{verse} package. As described in the documentation of this +% package,\footcite[6]{verse} the indentation pattern consists of an +% array of digits, \emph{d\textsubscript{1}} to +% \emph{d\textsubscript{n}}, where the \emph{n\textsuperscript{th}} +% line is indented by \emph{d\textsubscript{n}} times the amount of +% \cs{vgap} described above \vpageref{ref:verse-vin}. +% +% The overall structure of lines grouped into stanzas may look as +% follows:--- +% +% \iffalse +%<*example> +% \fi +\begin{minted}[escapeinside=++]{latex} +\begin{ekdverse}[type={+\emph{overall type}+}] + \identpattern{+\emph{digits}+} + \begin{patverse} + \begin{ekdstanza}[type={+\emph{stanza 1 type}+}] + line 1 \\ + line 2 \\ + [...] + final line \\! + \end{ekdstanza} + \end{patverse} +\end{ekdverse} +\end{minted} +% \iffalse +%</example> +% \fi +% +% Of course, if no indentation pattern be required or be only required +% occasionally, \env{patverse} (ll.~3 and 10) and \cs{indentpattern} +% (l.~2) are of no use:--- +% +% \iffalse +%<*example> +% \fi +\begin{minted}[escapeinside=++]{latex} +\begin{ekdverse}[type={+\emph{overall type}+}] + \begin{ekdstanza}[type={+\emph{stanza 1 type}+}] + line 1 \\ + line 2 \\ + \vin indented line 3 \\ + [...] + final line \\! + \end{ekdstanza} +\end{ekdverse} +\end{minted} +% \iffalse +%</example> +% \fi +% +% A detailed example follows. It is taken from +% \citename{McDonald1916}{editor}'s edition of Shakespeare's +% \emph{Sonnets} from the Quarto of 1609 with variorum +% readings.\footcite[Sonnet~1, \pno~15]{McDonald1916} Compared to +% \citename{McDonald1916}{shorteditor}'s edition, an effort has been +% made to use the typography and punctuation of the original edition +% which can be consulted online at the British Library's +% website.\footnote{Shake-speares \emph{Sonnets}. Neuer before +% Imprinted. (A Louers Complaint. By William +% Shake-speare.). \url{https://www.bl.uk/collection-items/first-edition-of-shakespeares-sonnets-1609}. +% Call number \texttt{C.21.c.44}, fol.~B.} However, this typographical +% refinement has been retained for the sonnet only. For the sake of +% clarity, the line numbers and the apparatus criticus use modern +% typography. The references to line numbers in the apparatus criticus +% have been made consistent with +% \citename{McDonald1916}{shorteditor}'s edition, as have the entries +% in the apparatus criticus, namely the bare line number followed by a +% dot, then the lemma text in bold face, then the variant in italic +% shape:--- +% +% \captof{Poetry: Shakespeare's Sonnet~1}[\label{lst:shak-sonnet1}] +% \iffalse +%<*example> +% \fi +\begin{minted}{latex} +\junicode % Use the Junicode font with 'hist' feature enabled for + % long-s +% MacDonald's style for numbers and entries in the apparatus +% criticus: +\SetHooks{ + refnumstyle=\normalfont, + postrefnum=.~, + lemmastyle=\bfseries, + readingstyle=\itshape +} +% The lines are to be centered horizontally: +\settowidth{\versewidth}{Feed'st thy lights flame with selfe +substantiall fewell,} +% Format of the outermost <div> element: +\NewDocumentEnvironment{ekdcenter}{}{\par\centering}{\nobreak\par} +\FormatDiv{1}{\begin{ekdcenter}}{\end{ekdcenter}} +\begin{ekdosis} + \ekddiv{type=sonnets, n=1, head=1} + \begin{ekdverse}[type=sonnet, width=\versewidth] + \indentpattern{00000000000011} + \begin{patverse} + \begin{ekdstanza}[type=quatrain] + \ekdlettrine{F}{r}om fairest creatures we desire + increase,\\ + That thereby beauties \emph{Rose} + \app{ + \lem{might} + \rdg[source={Gildon1710, Sewell1725, Ewing1771}]{may} + } neuer die,\\ + But as the riper should by time + \app{ + \lem{decease} + \rdg[source=Hudson1856]{decrease} + },\\ + His tender heire might beare his memory:\\ + \end{ekdstanza} + \begin{ekdstanza}[type=quatrain] + But thou contracted to thine owne bright eyes,\\ + Feed'st thy + \app{ + \lem{lights} + \rdg[source={Butler1899, Walsh1908}]{life's} + } flame with + \app{ + \lem{selfe substantiall} + \rdg[source=Gildon1714, + alt={\textnormal{Hyphened by}}]{selfe-substantiall} + \note{etc.}} fewell,\\ + Making a famine where aboundance lies,\\ + Thy selfe thy foe,to thy sweet selfe too cruell:\\ + \end{ekdstanza} + \begin{ekdstanza}[type=quatrain] + Thou that art now the worlds fresh ornament,\\ + And + \app{ + \lem{only} + \rdg[resp=God, type=conjecture]{early} + \note{conj.} + } herauld to the gaudy spring,\\ + Within thine owne bud buriest thy content,\\ + And tender + \app{ + \lem{chorle} + \rdg[source=Gildon1710]{churl} + \note{etc.} + } makst wast in niggarding:\\ + \end{ekdstanza} + \begin{ekdstanza}[type=couplet] + Pitty the world,or else this glutton be,\\ + To eate the worlds due,\app{ + \lem{by the} + \rdg[resp=Stee, type=conjecture]{be thy} + \note{conj.} + \rdg[resp=God, type=conjecture]{by thy} + \note{conj.} + } graue + \app{ + \lem{and} + \rdg[resp=God, type=conjecture]{as} + \note{conj.} + } thee.\\! + \end{ekdstanza} + \end{patverse} + \end{ekdverse} +\end{ekdosis} +\end{minted} +% \iffalse +%</example> +% \fi +% +% \begin{remarks} +% \item |Gildon1710|, |Gildon1714|, |Sewell1725|, |Ewing1771|, +% |Hudson1856|, |Butler1899| and |Walsh1908| have been declared as +% sources.\footnote{See above \vpageref{ref:declare-source} and +% below \vref{sec:references-cited-works}.} |God| and |Stee|, +% resp.\ Godwin and Steevens, have been decalred as +% scholars.\footnote{See above \vpageref{ref:declare-scholar}.} +% \item \cs{ekdlettrine} (l.~23) is a specific command for the +% \pkg{lettrine} package does not work in list +% environments. \cs{TeXtoTEIPat} has been used as described below +% \vpageref{ref:textoteipat} to instruct \pkg{ekdosis} to convert +% this command into an acceptable \texttt{TEI} equivalent. The +% definition of \cs{ekdlettrine} follows:--- +% \iffalse +%<*example> +% \fi +\begin{minted}[linenos=false]{latex} +% Preamble: +\usepackage{adjustbox} +% This basic command actually requires an adjustment of the vertical +% space at the end of the current line (eg. \\[-1.875ex]) and \vin at +% the beginning of the next line:--- +\NewDocumentCommand{\ekdlettrine}{mm}{% +\adjustbox{valign=t,raise=-0.75ex}{\Huge #1}\textsc{#2}% +} +\TeXtoTEIPat{\ekdlettrine {#1}{#2}}{<hi rend="smallcaps">#1#2</hi>} +\end{minted} +% \iffalse +%</example> +% \fi +% \end{remarks} +% +% PDF output:--- +% \medskip +% +% \begingroup +% \junicode +% \SetHooks{ +% refnumstyle=\normalfont, +% postrefnum=.~, +% lemmastyle=\bfseries, +% readingstyle=\itshape +% } +% \renewcommand\thelinenumber{} +% \settowidth{\versewidth}{Feed'st thy lights flame with selfe +% substantiall fewell,} +% \FormatDiv{1}{\begin{ekdcenter}}{\end{ekdcenter}} +% \needspace{7\baselineskip} +% \resetlinenumber\resetvlinenumber +% \begin{alignment}[flush, +% tcols=1, +% texts=shakespeare[xml:lang="en"], +% apparatus=shakespeare] +% \setlength{\vrightskip}{-0.75in} +% \begin{shakespeare} +% \ekddiv{type=sonnets, n=1, head=1} +% \begin{ekdverse}[type=sonnet, width=\versewidth] +% \indentpattern{00000000000011} +% \begin{patverse} +% \begin{ekdstanza}[type=quatrain] +% \ekdlettrine{F}{r}om fairest creatures we desire +% increase,\\[-1.875ex] +% \vin That thereby beauties \emph{Rose} +% \app{ +% \lem{might} +% \rdg[source={shGildon1710, shSewell1725, shEwing1771}]{may} +% } neuer die,\\ +% But as the riper should by time +% \app{ +% \lem{decease} +% \rdg[source=shHudson1856]{decrease} +% },\\ +% His tender heire might beare his memory:\\ +% \end{ekdstanza} +% \begin{ekdstanza}[type=quatrain] +% But thou contracted to thine owne bright eyes,\\ +% Feed'st thy +% \app{ +% \lem{lights} +% \rdg[source={shButler1899, shWalsh1908}]{life's} +% } flame with +% \app{ +% \lem{selfe substantiall} +% \rdg[source=shGildon1714, +% alt={\textnormal{Hyphened by}}]{selfe-substantiall} +% \note{etc.}} fewell,\\ +% Making a famine where aboundance lies,\\ +% Thy selfe thy foe,to thy sweet selfe too cruell:\\ +% \end{ekdstanza} +% \begin{ekdstanza}[type=quatrain] +% Thou that art now the worlds fresh ornament,\\ +% And +% \app{ +% \lem{only} +% \rdg[resp=shGod, type=conjecture]{early} +% \note{conj.} +% } herauld to the gaudy spring,\\ +% Within thine owne bud buriest thy content,\\ +% And tender +% \app{ +% \lem{chorle} +% \rdg[source=shGildon1710]{churl} +% \note{etc.} +% } makst wast in niggarding:\\ +% \end{ekdstanza} +% \begin{ekdstanza}[type=couplet] +% Pitty the world,or else this glutton be,\\ +% To eate the worlds due,\app{ +% \lem{by the} +% \rdg[resp=shStee, type=conjecture]{be thy} +% \note{conj.} +% \rdg[resp=shGod, type=conjecture]{by thy} +% \note{conj.} +% } graue +% \app{ +% \lem{and} +% \rdg[resp=shGod, type=conjecture]{as} +% \note{conj.} +% } thee.\\! +% \end{ekdstanza} +% \end{patverse} +% \end{ekdverse} +% \end{shakespeare} +% \end{alignment} +% \endgroup +% +% \texttt{TEI xml} output:--- +% \medskip +% +% \iffalse +%<*example> +% \fi +\begin{minted}[linenos=false]{xml} +<div type="sonnets" n="1"> + <head>1</head> + <lg type="sonnet"> + <lg type="quatrain"> + <l> + <hi rend="smallcaps">Fr</hi>om fairest creatures we + desire increase,</l> + <l>That thereby beauties + <emph>Rose</emph> + <app> + <lem>might</lem> + <rdg source="#Gildon1710 #Sewell1725 #Ewing1771"> + may</rdg> + </app>neuer die,</l> + <l>But as the riper should by time + <app> + <lem>decease</lem> + <rdg source="#Hudson1856">decrease</rdg> + </app>,</l> + <l>His tender heire might beare his memory:</l> + </lg> + <lg type="quatrain"> + <l>But thou contracted to thine owne bright eyes,</l> + <l>Feed'st thy + <app> + <lem>lights</lem> + <rdg source="#Butler1899 #Walsh1908"> + life's</rdg> + </app>flame with + <app> + <lem>selfe substantiall</lem> + <rdg source="#Gildon1714"> + selfe-substantiall</rdg> + <note>etc.</note> + </app>fewell,</l> + <l>Making a famine where aboundance lies,</l> + <l>Thy selfe thy foe,to thy sweet selfe too + cruell:</l> + </lg> + <lg type="quatrain"> + <l>Thou that art now the worlds fresh ornament,</l> + <l>And + <app> + <lem>only</lem> + <rdg resp="#God" type="conjecture">early</rdg> + <note>conj.</note> + </app>herauld to the gaudy spring,</l> + <l>Within thine owne bud buriest thy content,</l> + <l>And tender + <app> + <lem>chorle</lem> + <rdg source="#Gildon1710">churl</rdg> + <note>etc.</note> + </app>makst wast in niggarding:</l> + </lg> + <lg type="couplet"> + <l>Pitty the world,or else this glutton be,</l> + <l>To eate the worlds due, + <app> + <lem>by the</lem> + <rdg resp="#Stee" type="conjecture">be thy</rdg> + <note>conj.</note> + <rdg resp="#God" type="conjecture">by thy</rdg> + <note>conj.</note> + </app>graue + <app> + <lem>and</lem> + <rdg resp="#God" type="conjecture">as</rdg> + <note>conj.</note> + </app>thee.</l> + </lg> + </lg> +</div> +\end{minted} +% \iffalse +%</example> +% \fi +% % \section{Lineation Settings} % \label{sec:lineation} % \danger \pkg{ekdosis} uses \pkg{lineno} internally for line @@ -3454,6 +4395,7 @@ argument of the % options} may be used in the preamble or at any point of the document % to set lineation preferences. Its argument processes the |key=value| % options that follow:---\\ +% \textbf{General Options}\\ % \DescribeOption{lineation} |lineation|$=$\verb+page|document+ % \hfill\tcboxverb{Default: document}\\ % |lineation=document| has the lines numbered continuously throughout @@ -3479,14 +4421,36 @@ argument of the % elides the last number of a range to the fewest number of figures % possible\---viz. 35--7, 129--31 \emph{\&c.}\---without eliding % digits in the group 10 to 19 in each hundred\---viz. 17--19, 115--18 -% \emph{\&c.} |numbers=full| leaves the numbers untouched. -% +% \emph{\&c.} |numbers=full| leaves the numbers untouched.\\ % \DescribeMacro{\innerlinenumbers} \DescribeMacro{\outerlinenumbers} % \cs{innerlinenumbers} and \cs{outerlinenumbers} are equivalent to % \cs{SetLineation}|{numb|\allowbreak|ers=outer}| and % \cs{SetLineation}|{numbers=inner}| respectively. Both commands are % complementary to \cs{rightlinenumbers} and \cs{leftlinenumbers} -% already provided by the \pkg{lineno} package. +% already provided by the \pkg{lineno} package.\\ +% \textbf{Options Specific to the |poetry=verse| Global +% Setting}\footnote{See above +% \vref{sec:verse-package}.}\phts\label{ref:verse-lineation}\\ +% \DescribeOption{vlineation} |vlineation|$=$\verb+page|document+ +% \hfill\tcboxverb{Default: document}\\ +% |vlineation| operates on verse texts in the same way as |lineation| +% on prose texts.\\ +% \DescribeOption{vmodulo} |vmodulo|$=$\emph{n} (where \emph{n} is +% an integer)\hfill\tcboxverb{Initially: 1, Default: 5}\\ +% |vmodulo|$=$\emph{n} has every \emph{n\textsuperscript{th}} lines of +% verse printed in the margin. If used without value, this option is +% equivalent to |vmodulo=5|. |vmodulo=0| prevents the +% numbers from being printed.\\ +% \DescribeOption{vmargin} |vmargin|$=$\verb+right|left+ +% \hfill\tcboxverb{Default: right}\\ +% |vmargin| sets the margin in which the verse line numbers are to be +% printed.\\ +% \DescribeOption{continuousvnum}\hfill\tcboxverb{Default: not set}\\ +% The |poetry=verse| global option has the succeeding lines of verse +% numbered independently of prose text. |continuousvnum| has all lines +% numbered continuously, irrespective of whether they are lines of +% prose or poetry text. +% % % \paragraph{Useful Lineation Commands} % As implied above, pretty much all commands that are provided by the @@ -3504,13 +4468,32 @@ argument of the % \DescribeMacro{\linenumbersep} \cs{linenumbersep} is the distance % between the numbers and the margin. By default, this distance is set % to \unit[10]{pt}. It can be redefined like so: -% \cs{setlength}\cs{linenumbersep}\marg{length}.\\ -% \DescribeMacro{\linelabel} \DescribeMacro{\lineref} -% \cs{linelabel}\marg{label} sets a line label that can be referred to -% with \cs{lineref}\marg{label}. +% \cs{setlength}\cs{linenumbersep}\marg{length}. +% +% \paragraph{Poetry Lineation Commands} +% In addition to these commands, if \pkg{ekdosis} be loaded with the +% global option |poetry=verse| as described above in +% \vref{sec:verse-package}, the commands dedicated to line numbering +% that are provided by the \pkg{verse} package can be used.\\ +% \DescribeMacro{\resetvlinenumber} \cs{resetvlinenumber}\oarg{n} has +% for lines of verse the same effect as \cs{resetlinenumber} for +% lines of prose text.\\ +% \DescribeMacro{\verselinenumfont} +% \cs{verselinenumfont}\marg{commands} can be used to set the font +% used for lines of verse. By default, the definition is +% |\normalfont\footnotesize|. \danger If the \cls{memoir} class be +% loaded, this command is replaced with \cs{linenumberfont} described +% above.\\ +% \DescribeMacro{\vrightskip} The \pkg{verse} package prints the +% numbers at the distance \cs{vrightskip} into the right margin. This +% distance can be redefined by means of \cs{setlength} like so: +% \cs{setlength}\cs{vrightskip}\allowbreak\marg{length}. % -% The reader is invited to refer to the documentation of the -% \pkg{lineno} package for more information. +% +% \paragraph{Labels} +% \DescribeMacro{\linelabel} \DescribeMacro{\ref} In prose as well +% as in poetry texts, \cs{linelabel}\marg{label} sets a line label +% that can be referred to with \cs{ref}\marg{label}. % % As an example, what follows has every fifth line number printed in % the inner margins. Additionally, the numbering shall start afresh at @@ -3556,6 +4539,14 @@ argument of the % file, the reader is invited to refer to point \vref{it:lang-subopt} % and \vref{sec:teixml-output}. % +% \danger In some cases, it may be needed to apply in the apparatus +% criticus a language different from the one that is selected in the +% edition text. To this end, \pkg{ekdosis} provides a set of +% facilities which are described +% \vpagerefrange{ref:app-lang}{ref:app-lang-opt} for single-layer +% apparatus and \vpageref{ref:apps-lang-opt} for multiple-layer +% apparatus. +% % \subsection{Languages Written From Right to Left} % \label{sec:rtl-languages} % As said above, \pkg{polyglossia} is not supported by \pkg{ekdosis} @@ -3633,7 +4624,7 @@ argument of the % \cs{setLR} are two argument-less commands provided by \pkg{ekdosis} % that can be used to change the writing direction of running % paragraphs. The former sets the direction from right to left and the -% latter form left to right. If \pkg{babel} has been set as above, +% latter form left to right. If \pkg{babel} be set as above, % \cs{setRL} \dots\ \cs{setLR} can be used in place of % \cs{begin}|{Arabic}| \dots\ \cs{end}|{Arabic}|. % @@ -4096,7 +5087,8 @@ subtype="arabtex">'inna 'abI kAna mina % % PDF output:--- % \medskip -% +% +% \begingroup % \needspace{7\baselineskip} % \resetlinenumber % \FormatDiv{1}{\begin{center}\Large}{\end{center}} @@ -4131,7 +5123,8 @@ subtype="arabtex">'inna 'abI kAna mina % θερινοὶ ἐν Κραννῶνι· [...] % \end{hippocrates} % \end{alignment} -% +% \endgroup +% % \texttt{TEI xml} output:--- % % \iffalse @@ -4185,6 +5178,8 @@ subtype="arabtex">'inna 'abI kAna mina % \hologo{LuaLaTeX} to be run three more times to get everything to % the right place with the right numbers. % +% \subsection{The Oscillating Problem} +% \label{sec:oscillating-problem} % In some instances, notably when on a given page entries are very % abundant in number, specifically when the edition text is getting % close to the bottom of the page, \pkg{ekdosis} may oscillate @@ -4192,7 +5187,7 @@ subtype="arabtex">'inna 'abI kAna mina % able to settle down. The condition may be typically illustrated as % follows: after Lua\LaTeX\ has been run, an entry is attached to the % last line of the page. As said above, this entry does not show -% yet. But when it does, if it results in an additional line being +% yet. But when it does, should it result in an additional line being % printed in the apparatus criticus, the last line of the edition % text\---the one the entry was previously attached to\---goes to the % next page. As a result, this entry also moves to the next page with @@ -4205,11 +5200,25 @@ subtype="arabtex">'inna 'abI kAna mina % % An alert reader may have guessed that inserting a \cs{pagebreak} is % 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, +% few pages be 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 substantial change in the preceding % pages may result in pages that break just after they begin. % +% \paragraph{Conditional page breaks} +% \DescribeMacro{\ekdpb} \cs{ekdpb}\oarg{page no}\marg{line no} +% \newfeature[v1.2]\\ +% One way to avoid this inconvenience is to use \cs{ekdpb} instead of +% the standard \cs{pagebreak} command provided by \LaTeX\ to insert +% conditional page breaks. \cs{ekdpb} takes as mandatory argument the +% line number, as it is printed in the margin, where the page break +% should take place. An optional argument allows to further specify +% the page number where the page break should occur. The value that is +% expected is the page number as it is printed\===e.g.\ an Arabic, +% Roman or alphanumeric number. If the specified conditions be not +% met, then the page break is not triggered. +% +% \paragraph{Using \texttt{maxentries}} % Another way\---should the edition text fall into the vicious circle % too often\---is to limit the number of entries per page that a given % layer of apparatus criticus may accept as described above @@ -4223,8 +5232,8 @@ subtype="arabtex">'inna 'abI kAna mina % should entries overflow on a given page, the edition text and the % 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. +% breaks. But if there be too many of them, it is a good indication +% that the selected value of |maxentries| is too 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, @@ -4262,9 +5271,9 @@ subtype="arabtex">'inna 'abI kAna mina % 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 +% \phts\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 @@ -4273,9 +5282,9 @@ subtype="arabtex">'inna 'abI kAna mina % 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:--- +% to define a command to have a dot printed only if not followed by a +% dot, and append this command to the abbreviated form of the word, +% like so:--- % % \iffalse %<*example> @@ -4306,7 +5315,7 @@ subtype="arabtex">'inna 'abI kAna mina % \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. +% must be used even if only one layer of critical notes be needed. % \end{remarks} % % \paragraph{Backup of Essential Files} @@ -4314,8 +5323,8 @@ subtype="arabtex">'inna 'abI kAna mina % 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 +% command has been inserted\---the compilation be frozen 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 @@ -4496,20 +5505,21 @@ subtype="arabtex">'inna 'abI kAna mina % of options} can be used in the preamble or at any point of the % document, except inside environments set to receive an apparatus % criticus, namely the \env{ekdosis} environment or any other similar -% environment declared by means of \cs{DeclareApparatus}.\footnote{See -% above \vref{sec:declaring-layers}.} At the time of writing, there is +% environment declared by means of the \env{alignment} environment or +% \cs{SetAlignment}.\footnote{See above +% \vref{sec:multiple-alignment}.} At the time of writing, there is % only one option, as follows:---\\ % \DescribeOption{autopar} |autopar|$=$\verb+true|false+ % \hfill\tcboxverb{Default: true}\\ % The algorithm described above applies for edition texts composed in -% running paragraphs or in lines of poetry, but it may fail to produce -% a valid \texttt{TEI xml} output with other arrangements, such as +% running paragraphs or lines of poetry, but it may fail to produce a +% valid \texttt{TEI xml} output with other arrangements, such as % performance texts or transcriptions of speech for which the % \texttt{TEI} Guidelines define specific rules. |autopar=false| % instructs \pkg{ekdosis} to ignore blank lines in the |.tex| source % file as markers for paragraph boundaries. As a result, each % paragraph of the edition text must be found within an environment -% associated with the \texttt{xml} |<p>| element, such as \env{ekdpar} +% associated with the \texttt{xml} element |<p>|, 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}| & |<ptr ="#label"/>| \\ % \cs{pagebreak}\meta{\oarg{1-4}} & no output \\ % \cs{mbox}\marg{text} & \meta{text} \\ +% \midrule +% \multicolumn{2}{c}{From the \pkg{extdash}\footcite{extdash} +% package:}\\ +% \cs{---} or \cs{===} & --- \\ +% \cs{--} or \cs{==} & -- \\ +% \cs{-/} or \cs{=/} & ‐ \\ % \bottomrule % \end{xltabular} % @@ -4590,8 +5606,6 @@ subtype="arabtex">'inna 'abI kAna mina % |center| & |<p rend="align(center)"></p>| \\ % |quotation| & |<quote></quote>| \\ % |quoting| & |<quote></quote>| \\ -% |ekdpar| & |<p></p>| \\ -% |ekdverse| & |<lg></lg>| \\ % |verse| & |<lg></lg>| \\ % \bottomrule % \end{xltabular} @@ -4603,7 +5617,7 @@ subtype="arabtex">'inna 'abI kAna mina % \cs{begin}|{quote}| \dots\ \cs{end}|{quote}| will result in % |<emph></emph>| and |<quote></quote>| 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. %</example> % \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 %</package> % \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{ "<lg" * ((1 - lpeg.S"<>") + lpeg.V(1))^0 * ">" } +local bclinegroup = lpeg.Cs(linegroup + lpeg.P("</lg>")) +local endpoem = lpeg.Cs(lnbrk * lpeg.S("*!") * bsqbrackets^-1) -- not used local sections = lpeg.Cs(lpeg.P("book") + lpeg.P("part") + lpeg.P("chapter") + lpeg.P("section") + lpeg.P("subsection") + lpeg.P("subsubsection")) local par = lpeg.P(lpeg.P("\\par") * spce^0) -local parb = lpeg.P(lpeg.Cs("\\p@rb") * spce^0) -local para = lpeg.P(lpeg.Cs("\\p@ra") * spce^0) +local parb = lpeg.P(lpeg.P("\\p@rb") * spce^0) +local para = lpeg.P(lpeg.P("\\p@ra") * spce^0) local labelrefcmds = lpeg.Cs(lpeg.P("label") + lpeg.P("linelabel") + lpeg.P("lineref") @@ -8170,28 +9424,37 @@ local texpatttotags = { {a="\\addentries%s+%[(.-)%]{(.-)}", b=""}, {a="\\addentries%s+{(.-)}", b=""}, {a="\\setverselinenums%s+{(.-)}{(.-)}", b=""}, + {a="\\resetvlinenumber%s+%[(.-)%]", b=""}, + {a="\\resetvlinenumber%s+", b=""}, {a="\\resetlinenumber%s+%[(.-)%]", b=""}, {a="\\resetlinenumber%s+", b=""}, + {a="\\indentpattern%s+{(.-)}", b=""}, + {a="\\settowidth%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"} + {a="\\RL%s+{(.-)}", b="%1"}, + {a="\\%=%=%=%s?", b="—"}, + {a="\\%-%-%-%s?", b="—"}, + {a="\\%=%=%s?", b="–"}, + {a="\\%-%-%s?", b="–"}, + {a="\\%=%/%s?", b="‐"}, + {a="\\%-%/%s?", b="‐"}, + {a="\\vin%s+", b=""} } local envtotags = { {a="flushright", b="p", c=" rend=\"align(right)\""}, {a="flushleft", b="p", c=" rend=\"align(left)\""}, {a="quotation", b="quote", c=""}, - {a="ekdverse", b="lg", c=""}, {a="txarabtr", b="p", c=" xml:lang=\"ar-Latn\" type=\"transliterated\""}, {a="quoting", b="quote", c=""}, {a="ekdpar", b="p", c=""}, {a="txarab", b="p", c=" xml:lang=\"arb\""}, {a="center", b="p", c=" rend=\"align(center)\""}, - {a="verse", b="lg", c=""}, {a="arab", b="p", c=" xml:lang=\"ar-Latn\" type=\"transliterated\" subtype=\"arabtex\""} } @@ -8226,8 +9489,16 @@ function ekdosis.newpatttotag(pat, repl) pat = string.gsub(pat, "([%[%]])", "%%%1") pat = string.gsub(pat, "%#[1-9]", "(.-)") repl = string.gsub(repl, "%#([1-9])", "%%%1") - table.insert(texpatttotags, { a = pat, b = repl }) - table.sort(texpatttotags, function(a ,b) return(#a.a > #b.a) end) + if isintable(texpatttotags, pat) + then + local index = get_a_index(pat, texpatttotags) + table.remove(texpatttotags, index) + table.insert(texpatttotags, { a = pat, b = repl }) + table.sort(texpatttotags, function(a ,b) return(#a.a > #b.a) end) + else + table.insert(texpatttotags, { a = pat, b = repl }) + table.sort(texpatttotags, function(a ,b) return(#a.a > #b.a) end) + end return true end @@ -8401,32 +9672,69 @@ local function relocate_notes(str) end local function linestotei(str) --- str = "\n<l>"..str - str = string.gsub(str, "^%s?(.-)\\\\[%!%*]?%s?$", "\n<l>%1</l>\n") --- str = gsub(str, endpoem, "</l>\n") - str = gsub(str, poemline * spcenc^-1 * lpeg.P(">"), "\n<lb/>") - str = gsub(str, poemline * spcenc^-1, "</l>\n<l>") --- str = str.."</l>\n" + if not string.find(str, "^%s?<lg") + then + str = "\n<l>"..str + end + str = gsub(str, poemline * spcenc^0 * bclinegroup, "</l>\n%2") + str = gsub(str, linegroup * -(spcenc^0 * bclinegroup), "%1\n<l>") + str = gsub(str, lpeg.Cs("</lg>") * -(spcenc^0 * (bclinegroup + -1)), "%1\n<l>") + -- str = gsub(str, poemline * spcenc^-1 * -1, "</l>\n") + str = gsub(str, poemlinebreak, "<lb/> ") + -- str = gsub(str, poemline * spcenc^-1 * lpeg.Cs("<lg"), "</l>%2") + -- str = gsub(str, lpeg.Cs("</lg>") * spcenc^1 * -lpeg.P("<l"), "%1\n<l>") + str = gsub(str, poemline, "</l>\n<l>") + return str +end + +local function stanzatotei(str) + str = string.gsub(str, "\\begin%s?%{ekdstanza%}(%b[])(.-)\\end%s?%{ekdstanza%}", function(opt, arg) + arg = string.gsub(arg, "\\par%s?", "") + opt = string.sub(opt, 2, -2) + teitype = get_attr_value(opt, "type") + if teitype ~= "" then teitype = " type=\""..teitype.."\"" else end + if opt == "" + then + return string.format("<lg>%s</lg>", arg) + else + return string.format("<lg%s>%s</lg>", teitype, arg) + end + end) + str = string.gsub(str, "\\begin%s?%{ekdstanza%}(.-)\\end%s?%{ekdstanza%}", function(arg) + arg = string.gsub(arg, "\\par%s?", "") + return string.format("<lg>%s</lg>", arg) + end) return str end -- better use lpeg: look into this later local function versetotei(str) - str = string.gsub(str, "(\\begin%s?%{ekdverse%})(%b[])(.-)(\\end%s?%{ekdverse%})", function(benv, opt, arg, eenv) - arg = linestotei(arg) - return string.format("%s%s%s%s", benv, opt, arg, eenv) + str = string.gsub(str, "\\begin%s?%{ekdverse%}(%b[])(.-)\\end%s?%{ekdverse%}", function(opt, arg) + arg = string.gsub(arg, "\\par%s?", "") + arg = string.gsub(arg, "\\begin%s?%{patverse%*?%}", "") + arg = string.gsub(arg, "\\end%s?%{patverse%*?%}", "") + arg = string.gsub(arg, "\\indentpattern%s?%b{}", "") + opt = string.sub(opt, 2, -2) + teitype = get_attr_value(opt, "type") + if teitype ~= "" then teitype = " type=\""..teitype.."\"" else end + if opt == "" + then + return "\\p@rb "..linestotei(string.format("<lg>%s</lg>", arg)).."\\p@ra " + else + return "\\p@rb "..linestotei(string.format("<lg%s>%s</lg>", teitype, arg)).."\\p@ra " + end end) - str = string.gsub(str, "(\\begin%s?%{ekdverse%})(.-)(\\end%s?%{ekdverse%})", function(benv, arg, eenv) - arg = linestotei(arg) - return string.format("%s%s%s", benv, arg, eenv) + str = string.gsub(str, "\\begin%s?%{ekdverse%}(.-)\\end%s?%{ekdverse%}", function(arg) + arg = string.gsub(arg, "\\par%s?", "") + return "\\p@rb "..linestotei(string.format("<lg>%s</lg>", arg)).."\\p@ra " end) - str = string.gsub(str, "(\\begin%s?%{verse%})(%b[])(.-)(\\end%s?%{verse%})", function(benv, opt, arg, eenv) - arg = linestotei(arg) - return string.format("%s%s%s%s", benv, opt, arg, eenv) + str = string.gsub(str, "\\begin%s?%{verse%}%b[](.-)\\end%s?%{verse%}", function(arg) + arg = string.gsub(arg, "\\par%s?", "") + return "\\p@rb "..linestotei(string.format("<lg>%s</lg>", arg)).."\\p@ra " end) - str = string.gsub(str, "(\\begin%s?%{verse%})(.-)(\\end%s?%{verse%})", function(benv, arg, eenv) - arg = linestotei(arg) - return string.format("%s%s%s", benv, arg, eenv) + str = string.gsub(str, "\\begin%s?%{verse%}(.-)\\end%s?%{verse%}", function(arg) + arg = string.gsub(arg, "\\par%s?", "") + return "\\p@rb "..linestotei(string.format("<lg>%s</lg>", arg)).."\\p@ra " end) return str end @@ -8897,7 +10205,7 @@ local function close_ekddivs_in_between(str) end for ndivi = 1, maxdepth do - str = string.gsub(str, "(<div .-depth%=\")("..ndivi..")(\".->)(.-)(<div .-depth%=\")(%d)(\".->)", + str = string.gsub(str, "(<div [^%>]-[Dd]epth%=\")("..ndivi..")(\".->)(.-)(<div [^%>]-depth%=\")(%d)(\".->)", function(bdivi, ndivi, edivi, between, bdivii, ndivii, edivii) local firstdiv = ndivi local lastdiv = ndivii @@ -8914,11 +10222,17 @@ local function close_ekddivs_in_between(str) firstdivindex = firstdivindex - 1 end end + bdivii = string.gsub(bdivii, "depth", "Depth") return string.format("%s%s%s%s%s%s%s%s", - bdivi, ndivi, edivi, between, closedivs, bdivii, ndivii, edivii) + bdivi, ndivi, edivi, between, + closedivs, bdivii, ndivii, edivii) end) end - str = string.gsub(str, "(<div.-)(%sdepth%=\"%d\")(.->)", "%1%3") + return str +end + +local function clean_ekddivs(str) + str = string.gsub(str, "(<div.-)(%s[Dd]epth%=\"%d\")(.->)", "%1%3") used_ndivs = {} return str end @@ -8926,7 +10240,7 @@ end local function close_ndivs_in_between(str) for ndivi = 1, 6 do - str = string.gsub(str, "(<div)("..ndivi..")(.->)(.-)(<div)([1-6])(.->)", + str = string.gsub(str, "(<[Dd]iv)("..ndivi..")(.->)(.-)(<div)([1-6])(.->)", function(bdivi, ndivi, edivi, between, bdivii, ndivii, edivii) local firstdiv = ndivi local lastdiv = ndivii @@ -8943,11 +10257,17 @@ local function close_ndivs_in_between(str) firstdivindex = firstdivindex - 1 end end + bdivii = string.gsub(bdivii, "div", "Div") return string.format("%s%s%s%s%s%s%s%s", - bdivi, ndivi, edivi, between, closedivs, bdivii, ndivii, edivii) - + bdivi, ndivi, edivi, between, + closedivs, bdivii, ndivii, edivii) end) end + return str +end + +local function clean_latexdivs(str) + str = string.gsub(str, "(<Div)([1-6])(.->)", "<div%2%3") used_ndivs = {} return str end @@ -8960,6 +10280,7 @@ local function textotei(str) str = rdgGrp_totei(str) str = lem_rdg_totei(str) str = relocate_notes(str) + str = stanzatotei(str) str = versetotei(str) str = envtotei(str) str = ekddivs_totei(str) @@ -8972,9 +10293,13 @@ local function textotei(str) then str = close_ekddivs_at_end(str) str = close_ekddivs_in_between(str) + str = close_ekddivs_in_between(str) + str = clean_ekddivs(str) else str = close_ndivs_at_end(str) str = close_ndivs_in_between(str) + str = close_ndivs_in_between(str) + str = clean_latexdivs(str) end return str end @@ -9478,7 +10803,8 @@ function ekdosis.newapparatus(teitype, appsep, appbhook, appehook, - applimit) + applimit, + applang) if isintable(apparatuses, teitype) then tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" @@ -9492,12 +10818,23 @@ function ekdosis.newapparatus(teitype, sep = appsep, bhook = appbhook, ehook = appehook, - limit = applimit}) + limit = applimit, + lang = applang}) end bagunits[teitype] = 1 return true end +function ekdosis.getapplang(teitype) + i = get_a_index(teitype, apparatuses) + if apparatuses[i].lang ~= "" + then + return apparatuses[i].lang + else + return "\\languagename" + end +end + function ekdosis.getappdelim(str) for i = 1,#apparatuses do @@ -9593,7 +10930,7 @@ function ekdosis.appout() local output = {} if next(apparatuses) == nil then -- table.insert(output, "BEGIN") - table.insert(output, "\\noindent\\csname ekd@default@rule\\endcsname\\NLS") + table.insert(output, "\\csname ekd@default@rule\\endcsname\\NLS") table.insert(output, "\\csname ekd@begin@apparatus\\endcsname\\ignorespaces") -- table.insert(output, "\\noindent ") for i in string.gmatch(t, @@ -9608,6 +10945,7 @@ function ekdosis.appout() end -- table.insert(output, "END") else + local appinserted = false local n = 1 while apparatuses[n] do @@ -9622,16 +10960,19 @@ function ekdosis.appout() table.insert(output, "\\bgroup{}") if apparatuses[n].direction == "LR" then - table.insert(output, "\\pardir TLT\\textdir TLT{}") + table.insert(output, "\\pardir TLT\\leavevmode\\textdir TLT{}") elseif apparatuses[n].direction == "RL" then - table.insert(output, "\\pardir TRT\\textdir TRT{}") + table.insert(output, "\\pardir TRT\\leavevmode\\textdir TRT{}") end if apparatuses[n].rule == "none" then if n > 1 then - table.insert(output, "\\NLS{}") + if appinserted + then + table.insert(output, "\\NLS{}") + end else table.insert(output, "\\noindent ") end @@ -9639,7 +10980,12 @@ function ekdosis.appout() then if n > 1 then - table.insert(output, "\\NLS{}" .. apparatuses[n].rule .. "\\NLS{}") + if appinserted + then + table.insert(output, "\\NLS{}" .. apparatuses[n].rule .. "\\NLS{}") + else + table.insert(output, apparatuses[n].rule .. "\\NLS{}") + end else -- table.insert(output, "\\noindent ") table.insert(output, apparatuses[n].rule .. "\\NLS{}") @@ -9647,7 +10993,12 @@ function ekdosis.appout() else if n > 1 then - table.insert(output, "\\NLS\\csname ekd@default@rule\\endcsname\\NLS{}") + if appinserted + then + table.insert(output, "\\NLS\\csname ekd@default@rule\\endcsname\\NLS{}") + else + table.insert(output, "\\csname ekd@default@rule\\endcsname\\NLS{}") + end else -- table.insert(output, "\\noindent ") table.insert(output, "\\csname ekd@default@rule\\endcsname\\NLS{}") @@ -9673,6 +11024,7 @@ function ekdosis.appout() ..curcol.."%-"..n..">") do table.insert(output, i) + appinserted = true end if apparatuses[n].ehook ~= "" then diff --git a/Master/texmf-dist/source/lualatex/ekdosis/ekdosis.ins b/Master/texmf-dist/source/lualatex/ekdosis/ekdosis.ins index 6427d379690..e0c3c84cf47 100644 --- a/Master/texmf-dist/source/lualatex/ekdosis/ekdosis.ins +++ b/Master/texmf-dist/source/lualatex/ekdosis/ekdosis.ins @@ -12,7 +12,7 @@ License:| Released under the GNU General Public License v3 or later This file is part of the `ekdosis' package ekdosis -- Typesetting TEI xml compliant critical editions -Copyright (C) 2020 Robert Alessi +Copyright (C) 2020--2021 Robert Alessi Please send error reports and suggestions for improvements to Robert Alessi <alessi@robertalessi.net> diff --git a/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.lua b/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.lua index 55d42fbc7bc..4916d9c586b 100644 --- a/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.lua +++ b/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.lua @@ -2,7 +2,7 @@ This file is part of the `ekdosis' package ekdosis -- Typesetting TEI xml-compliant critical editions -Copyright (C) 2020 Robert Alessi +Copyright (C) 2020--2021 Robert Alessi Please send error reports and suggestions for improvements to Robert Alessi <alessi@robertalessi.net> @@ -52,14 +52,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{ "<lg" * ((1 - lpeg.S"<>") + lpeg.V(1))^0 * ">" } +local bclinegroup = lpeg.Cs(linegroup + lpeg.P("</lg>")) +local endpoem = lpeg.Cs(lnbrk * lpeg.S("*!") * bsqbrackets^-1) -- not used local sections = lpeg.Cs(lpeg.P("book") + lpeg.P("part") + lpeg.P("chapter") + lpeg.P("section") + lpeg.P("subsection") + lpeg.P("subsubsection")) local par = lpeg.P(lpeg.P("\\par") * spce^0) -local parb = lpeg.P(lpeg.Cs("\\p@rb") * spce^0) -local para = lpeg.P(lpeg.Cs("\\p@ra") * spce^0) +local parb = lpeg.P(lpeg.P("\\p@rb") * spce^0) +local para = lpeg.P(lpeg.P("\\p@ra") * spce^0) local labelrefcmds = lpeg.Cs(lpeg.P("label") + lpeg.P("linelabel") + lpeg.P("lineref") @@ -401,28 +404,37 @@ local texpatttotags = { {a="\\addentries%s+%[(.-)%]{(.-)}", b=""}, {a="\\addentries%s+{(.-)}", b=""}, {a="\\setverselinenums%s+{(.-)}{(.-)}", b=""}, + {a="\\resetvlinenumber%s+%[(.-)%]", b=""}, + {a="\\resetvlinenumber%s+", b=""}, {a="\\resetlinenumber%s+%[(.-)%]", b=""}, {a="\\resetlinenumber%s+", b=""}, + {a="\\indentpattern%s+{(.-)}", b=""}, + {a="\\settowidth%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"} + {a="\\RL%s+{(.-)}", b="%1"}, + {a="\\%=%=%=%s?", b="—"}, + {a="\\%-%-%-%s?", b="—"}, + {a="\\%=%=%s?", b="–"}, + {a="\\%-%-%s?", b="–"}, + {a="\\%=%/%s?", b="‐"}, + {a="\\%-%/%s?", b="‐"}, + {a="\\vin%s+", b=""} } local envtotags = { {a="flushright", b="p", c=" rend=\"align(right)\""}, {a="flushleft", b="p", c=" rend=\"align(left)\""}, {a="quotation", b="quote", c=""}, - {a="ekdverse", b="lg", c=""}, {a="txarabtr", b="p", c=" xml:lang=\"ar-Latn\" type=\"transliterated\""}, {a="quoting", b="quote", c=""}, {a="ekdpar", b="p", c=""}, {a="txarab", b="p", c=" xml:lang=\"arb\""}, {a="center", b="p", c=" rend=\"align(center)\""}, - {a="verse", b="lg", c=""}, {a="arab", b="p", c=" xml:lang=\"ar-Latn\" type=\"transliterated\" subtype=\"arabtex\""} } @@ -457,8 +469,16 @@ function ekdosis.newpatttotag(pat, repl) pat = string.gsub(pat, "([%[%]])", "%%%1") pat = string.gsub(pat, "%#[1-9]", "(.-)") repl = string.gsub(repl, "%#([1-9])", "%%%1") - table.insert(texpatttotags, { a = pat, b = repl }) - table.sort(texpatttotags, function(a ,b) return(#a.a > #b.a) end) + if isintable(texpatttotags, pat) + then + local index = get_a_index(pat, texpatttotags) + table.remove(texpatttotags, index) + table.insert(texpatttotags, { a = pat, b = repl }) + table.sort(texpatttotags, function(a ,b) return(#a.a > #b.a) end) + else + table.insert(texpatttotags, { a = pat, b = repl }) + table.sort(texpatttotags, function(a ,b) return(#a.a > #b.a) end) + end return true end @@ -632,32 +652,69 @@ local function relocate_notes(str) end local function linestotei(str) --- str = "\n<l>"..str - str = string.gsub(str, "^%s?(.-)\\\\[%!%*]?%s?$", "\n<l>%1</l>\n") --- str = gsub(str, endpoem, "</l>\n") - str = gsub(str, poemline * spcenc^-1 * lpeg.P(">"), "\n<lb/>") - str = gsub(str, poemline * spcenc^-1, "</l>\n<l>") --- str = str.."</l>\n" + if not string.find(str, "^%s?<lg") + then + str = "\n<l>"..str + end + str = gsub(str, poemline * spcenc^0 * bclinegroup, "</l>\n%2") + str = gsub(str, linegroup * -(spcenc^0 * bclinegroup), "%1\n<l>") + str = gsub(str, lpeg.Cs("</lg>") * -(spcenc^0 * (bclinegroup + -1)), "%1\n<l>") + -- str = gsub(str, poemline * spcenc^-1 * -1, "</l>\n") + str = gsub(str, poemlinebreak, "<lb/> ") + -- str = gsub(str, poemline * spcenc^-1 * lpeg.Cs("<lg"), "</l>%2") + -- str = gsub(str, lpeg.Cs("</lg>") * spcenc^1 * -lpeg.P("<l"), "%1\n<l>") + str = gsub(str, poemline, "</l>\n<l>") + return str +end + +local function stanzatotei(str) + str = string.gsub(str, "\\begin%s?%{ekdstanza%}(%b[])(.-)\\end%s?%{ekdstanza%}", function(opt, arg) + arg = string.gsub(arg, "\\par%s?", "") + opt = string.sub(opt, 2, -2) + teitype = get_attr_value(opt, "type") + if teitype ~= "" then teitype = " type=\""..teitype.."\"" else end + if opt == "" + then + return string.format("<lg>%s</lg>", arg) + else + return string.format("<lg%s>%s</lg>", teitype, arg) + end + end) + str = string.gsub(str, "\\begin%s?%{ekdstanza%}(.-)\\end%s?%{ekdstanza%}", function(arg) + arg = string.gsub(arg, "\\par%s?", "") + return string.format("<lg>%s</lg>", arg) + end) return str end -- better use lpeg: look into this later local function versetotei(str) - str = string.gsub(str, "(\\begin%s?%{ekdverse%})(%b[])(.-)(\\end%s?%{ekdverse%})", function(benv, opt, arg, eenv) - arg = linestotei(arg) - return string.format("%s%s%s%s", benv, opt, arg, eenv) + str = string.gsub(str, "\\begin%s?%{ekdverse%}(%b[])(.-)\\end%s?%{ekdverse%}", function(opt, arg) + arg = string.gsub(arg, "\\par%s?", "") + arg = string.gsub(arg, "\\begin%s?%{patverse%*?%}", "") + arg = string.gsub(arg, "\\end%s?%{patverse%*?%}", "") + arg = string.gsub(arg, "\\indentpattern%s?%b{}", "") + opt = string.sub(opt, 2, -2) + teitype = get_attr_value(opt, "type") + if teitype ~= "" then teitype = " type=\""..teitype.."\"" else end + if opt == "" + then + return "\\p@rb "..linestotei(string.format("<lg>%s</lg>", arg)).."\\p@ra " + else + return "\\p@rb "..linestotei(string.format("<lg%s>%s</lg>", teitype, arg)).."\\p@ra " + end end) - str = string.gsub(str, "(\\begin%s?%{ekdverse%})(.-)(\\end%s?%{ekdverse%})", function(benv, arg, eenv) - arg = linestotei(arg) - return string.format("%s%s%s", benv, arg, eenv) + str = string.gsub(str, "\\begin%s?%{ekdverse%}(.-)\\end%s?%{ekdverse%}", function(arg) + arg = string.gsub(arg, "\\par%s?", "") + return "\\p@rb "..linestotei(string.format("<lg>%s</lg>", arg)).."\\p@ra " end) - str = string.gsub(str, "(\\begin%s?%{verse%})(%b[])(.-)(\\end%s?%{verse%})", function(benv, opt, arg, eenv) - arg = linestotei(arg) - return string.format("%s%s%s%s", benv, opt, arg, eenv) + str = string.gsub(str, "\\begin%s?%{verse%}%b[](.-)\\end%s?%{verse%}", function(arg) + arg = string.gsub(arg, "\\par%s?", "") + return "\\p@rb "..linestotei(string.format("<lg>%s</lg>", arg)).."\\p@ra " end) - str = string.gsub(str, "(\\begin%s?%{verse%})(.-)(\\end%s?%{verse%})", function(benv, arg, eenv) - arg = linestotei(arg) - return string.format("%s%s%s", benv, arg, eenv) + str = string.gsub(str, "\\begin%s?%{verse%}(.-)\\end%s?%{verse%}", function(arg) + arg = string.gsub(arg, "\\par%s?", "") + return "\\p@rb "..linestotei(string.format("<lg>%s</lg>", arg)).."\\p@ra " end) return str end @@ -1128,7 +1185,7 @@ local function close_ekddivs_in_between(str) end for ndivi = 1, maxdepth do - str = string.gsub(str, "(<div .-depth%=\")("..ndivi..")(\".->)(.-)(<div .-depth%=\")(%d)(\".->)", + str = string.gsub(str, "(<div [^%>]-[Dd]epth%=\")("..ndivi..")(\".->)(.-)(<div [^%>]-depth%=\")(%d)(\".->)", function(bdivi, ndivi, edivi, between, bdivii, ndivii, edivii) local firstdiv = ndivi local lastdiv = ndivii @@ -1145,11 +1202,17 @@ local function close_ekddivs_in_between(str) firstdivindex = firstdivindex - 1 end end + bdivii = string.gsub(bdivii, "depth", "Depth") return string.format("%s%s%s%s%s%s%s%s", - bdivi, ndivi, edivi, between, closedivs, bdivii, ndivii, edivii) + bdivi, ndivi, edivi, between, + closedivs, bdivii, ndivii, edivii) end) end - str = string.gsub(str, "(<div.-)(%sdepth%=\"%d\")(.->)", "%1%3") + return str +end + +local function clean_ekddivs(str) + str = string.gsub(str, "(<div.-)(%s[Dd]epth%=\"%d\")(.->)", "%1%3") used_ndivs = {} return str end @@ -1157,7 +1220,7 @@ end local function close_ndivs_in_between(str) for ndivi = 1, 6 do - str = string.gsub(str, "(<div)("..ndivi..")(.->)(.-)(<div)([1-6])(.->)", + str = string.gsub(str, "(<[Dd]iv)("..ndivi..")(.->)(.-)(<div)([1-6])(.->)", function(bdivi, ndivi, edivi, between, bdivii, ndivii, edivii) local firstdiv = ndivi local lastdiv = ndivii @@ -1174,11 +1237,17 @@ local function close_ndivs_in_between(str) firstdivindex = firstdivindex - 1 end end + bdivii = string.gsub(bdivii, "div", "Div") return string.format("%s%s%s%s%s%s%s%s", - bdivi, ndivi, edivi, between, closedivs, bdivii, ndivii, edivii) - + bdivi, ndivi, edivi, between, + closedivs, bdivii, ndivii, edivii) end) end + return str +end + +local function clean_latexdivs(str) + str = string.gsub(str, "(<Div)([1-6])(.->)", "<div%2%3") used_ndivs = {} return str end @@ -1191,6 +1260,7 @@ local function textotei(str) str = rdgGrp_totei(str) str = lem_rdg_totei(str) str = relocate_notes(str) + str = stanzatotei(str) str = versetotei(str) str = envtotei(str) str = ekddivs_totei(str) @@ -1203,9 +1273,13 @@ local function textotei(str) then str = close_ekddivs_at_end(str) str = close_ekddivs_in_between(str) + str = close_ekddivs_in_between(str) + str = clean_ekddivs(str) else str = close_ndivs_at_end(str) str = close_ndivs_in_between(str) + str = close_ndivs_in_between(str) + str = clean_latexdivs(str) end return str end @@ -1709,7 +1783,8 @@ function ekdosis.newapparatus(teitype, appsep, appbhook, appehook, - applimit) + applimit, + applang) if isintable(apparatuses, teitype) then tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" @@ -1723,12 +1798,23 @@ function ekdosis.newapparatus(teitype, sep = appsep, bhook = appbhook, ehook = appehook, - limit = applimit}) + limit = applimit, + lang = applang}) end bagunits[teitype] = 1 return true end +function ekdosis.getapplang(teitype) + i = get_a_index(teitype, apparatuses) + if apparatuses[i].lang ~= "" + then + return apparatuses[i].lang + else + return "\\languagename" + end +end + function ekdosis.getappdelim(str) for i = 1,#apparatuses do @@ -1824,7 +1910,7 @@ function ekdosis.appout() local output = {} if next(apparatuses) == nil then -- table.insert(output, "BEGIN") - table.insert(output, "\\noindent\\csname ekd@default@rule\\endcsname\\NLS") + table.insert(output, "\\csname ekd@default@rule\\endcsname\\NLS") table.insert(output, "\\csname ekd@begin@apparatus\\endcsname\\ignorespaces") -- table.insert(output, "\\noindent ") for i in string.gmatch(t, @@ -1839,6 +1925,7 @@ function ekdosis.appout() end -- table.insert(output, "END") else + local appinserted = false local n = 1 while apparatuses[n] do @@ -1853,16 +1940,19 @@ function ekdosis.appout() table.insert(output, "\\bgroup{}") if apparatuses[n].direction == "LR" then - table.insert(output, "\\pardir TLT\\textdir TLT{}") + table.insert(output, "\\pardir TLT\\leavevmode\\textdir TLT{}") elseif apparatuses[n].direction == "RL" then - table.insert(output, "\\pardir TRT\\textdir TRT{}") + table.insert(output, "\\pardir TRT\\leavevmode\\textdir TRT{}") end if apparatuses[n].rule == "none" then if n > 1 then - table.insert(output, "\\NLS{}") + if appinserted + then + table.insert(output, "\\NLS{}") + end else table.insert(output, "\\noindent ") end @@ -1870,7 +1960,12 @@ function ekdosis.appout() then if n > 1 then - table.insert(output, "\\NLS{}" .. apparatuses[n].rule .. "\\NLS{}") + if appinserted + then + table.insert(output, "\\NLS{}" .. apparatuses[n].rule .. "\\NLS{}") + else + table.insert(output, apparatuses[n].rule .. "\\NLS{}") + end else -- table.insert(output, "\\noindent ") table.insert(output, apparatuses[n].rule .. "\\NLS{}") @@ -1878,7 +1973,12 @@ function ekdosis.appout() else if n > 1 then - table.insert(output, "\\NLS\\csname ekd@default@rule\\endcsname\\NLS{}") + if appinserted + then + table.insert(output, "\\NLS\\csname ekd@default@rule\\endcsname\\NLS{}") + else + table.insert(output, "\\csname ekd@default@rule\\endcsname\\NLS{}") + end else -- table.insert(output, "\\noindent ") table.insert(output, "\\csname ekd@default@rule\\endcsname\\NLS{}") @@ -1904,6 +2004,7 @@ function ekdosis.appout() ..curcol.."%-"..n..">") do table.insert(output, i) + appinserted = true end if apparatuses[n].ehook ~= "" then diff --git a/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty b/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty index 3e8094f9c14..c313fe5d29c 100644 --- a/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty +++ b/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty @@ -15,7 +15,7 @@ %% This file is part of the `ekdosis' package %% %% ekdosis -- Typesetting TEI xml compliant critical editions -%% Copyright (C) 2020 Robert Alessi +%% Copyright (C) 2020--2021 Robert Alessi %% %% Please send error reports and suggestions for improvements to Robert %% Alessi <alessi@robertalessi.net> @@ -41,7 +41,7 @@ %% Running "make inst" installs the files in the user's TeX tree. \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{ekdosis} - [2020/11/04 v1.1 Typesetting TEI xml-compliant critical editions] + [2021/04/02 v1.2 Typesetting TEI xml-compliant critical editions] \RequirePackage{iftex} \RequireLuaTeX \RequirePackage{expkv-opt} @@ -52,6 +52,7 @@ \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}}, @@ -64,7 +65,9 @@ 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}}, @@ -85,6 +88,9 @@ `tidy'.} } \ekvoProcessLocalOptions{ekdosis} +\newif\ifekd@memoir@loaded +\@ifclassloaded{memoir}{% + \ekd@memoir@loadedtrue\@pkg@poetry@versetrue}{} \RequirePackage{luacode} \RequirePackage{paracol} \RequirePackage{etoolbox} @@ -96,7 +102,7 @@ \RequirePackage{ltxcmds} \RequirePackage{pdftexcmds} \RequirePackage{ifoddpage} -\if@pkg@verse +\if@pkg@poetry@verse \RequirePackage{verse} \fi \if@pkg@parnotes @@ -110,9 +116,16 @@ 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}} \ekvdefinekeys{ekd@witness}{ @@ -237,6 +250,7 @@ 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} @@ -255,7 +269,8 @@ \luastringO{\sep@val}, \luastringO{\bhook@val}, \luastringO{\ehook@val}, - \luastringO{\limit@val} + \luastringO{\limit@val}, + \luastringO{\lang@val} )} \egroup } @@ -264,6 +279,29 @@ \luadirect{ekdosis.addto_bagunits(\luastringO{#1}, \luastringN{#2})}% \ignorespaces } +\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 +} \newbool{do@app} \newif\ifekd@state \newif\ifekd@isinapp @@ -281,8 +319,8 @@ {\luadirect{ekdosis.appin(\luastringO{#2})}} {\luadirect{ekdosis.appin(\luastringO{#2}, \luastringO{#1})}}% } - % \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 @@ -316,7 +354,9 @@ 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}{} } \NewDocumentCommand{\SetApparatus}{m}{ \ekvset{default@app}{#1} @@ -327,6 +367,8 @@ \NewDocumentCommand{\SetBeginApparatus}{m}{\edef\ekd@begin@apparatus{#1}} \NewDocumentCommand{\SetEndApparatus}{m}{\edef\ekd@end@apparatus{#1}} \NewDocumentCommand{\SetUnitDelimiter}{m}{\def\ekd@unit@delim{#1}} +\NewDocumentCommand{\SetApparatusLanguage}{m}{% + \def\ekd@singleapp@lang{#1}} \newif\iffootnoterule \footnoteruletrue \let\dflt@footnoterule\footnoterule @@ -348,43 +390,65 @@ \def\ekd@default@rule{#1}% \fi} \newcommand*{\NLS}{% - \par% - \nobreak% - \vspace{-\parskip}% - \noindent% - \ignorespaces} + \nobreak\@normalcr\relax + % \par + % \nobreak + % \vspace{-\parskip}% + % \leavevmode + % \noindent + % \ignorespaces +} \newif\ifsubsq@unit \subsq@unittrue \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 } \def\add@apparatus{% \test@apparatus% @@ -403,8 +467,8 @@ {\luadirect{tex.sprint(ekdosis.mdvappend(\luastringO{#2}))}} {\luadirect{tex.sprint(ekdosis.mdvappend(\luastringO{#2}, \luastringO{#1}))}}} -\def\outerlinenumbers{ - \def\makeLineNumberRunning{ +\def\outerlinenumbers{% + \def\makeLineNumberRunning{% \checkoddpage \ifoddpage \linenumberfont\hskip\linenumbersep\hskip\textwidth @@ -412,10 +476,10 @@ \else \hss\linenumberfont\LineNumber\hskip\linenumbersep \fi - } + }% } -\def\innerlinenumbers{ - \def\makeLineNumberRunning{ +\def\innerlinenumbers{% + \def\makeLineNumberRunning{% \checkoddpage \ifoddpage \hss\linenumberfont\LineNumber\hskip\linenumbersep @@ -423,9 +487,10 @@ \linenumberfont\hskip\linenumbersep\hskip\textwidth \hbox to\linenumberwidth{\hss\LineNumber}\hss \fi - } + }% } \newif\ifekd@pagelineation +\newif\ifekd@pagevlineation \NewDocumentCommand{\ekdatbegshihook}{}{% \ifekd@pagelineation\resetlinenumber\fi } @@ -436,11 +501,17 @@ 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 @@ -452,7 +523,12 @@ 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'} } \NewDocumentCommand{\SetLineation}{m}{ \ekvset{ekd@lineation}{#1} @@ -484,34 +560,36 @@ = 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 % @@ -519,17 +597,18 @@ \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}% + }% } \def\current@ref{{%\textdir TLT% \unexpanded\expandafter{\ekd@refnumstyle}% @@ -540,33 +619,41 @@ = 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 % @@ -574,18 +661,21 @@ \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}% + }% } \ekvdefinekeys{lem}{ code wit = \def\ekdlr@wit{#1}, @@ -617,6 +707,13 @@ \NewDocumentCommand{\rdgGrp}{O{} > {\TrimSpaces } m}{% \luadirect{tex.sprint(ekdosis.removesp(\luastringN{#2}))}% } +\def\app@lang{% + \ifekd@mapps + \luadirect{tex.sprint(ekdosis.getapplang(\luastring{\ekdan@type}))}% + \else + \ekd@singleapp@lang + \fi +} \NewDocumentCommand{\lem}{O{} m}{% \ekd@isinlemtrue% \luadirect{ekdosis.dolnlab(\luastringN{#2})}% @@ -657,13 +754,15 @@ \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 @@ -691,17 +790,21 @@ \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 @@ -743,13 +846,15 @@ \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 @@ -768,17 +873,20 @@ \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 @@ -845,7 +953,8 @@ \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% @@ -861,14 +970,16 @@ \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}% @@ -894,7 +1005,11 @@ \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}{% @@ -911,7 +1026,11 @@ \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}{% @@ -1147,13 +1266,52 @@ \fi \endgroup } -\if@pkg@verse -\verselinenumfont{\normalfont\footnotesize} +\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 +} +\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 @@ -1164,22 +1322,23 @@ \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} \else \newlength{\ekdverseindentlength} \setlength{\ekdverseindentlength}{\parindent} -\NewDocumentEnvironment{ekdverse}{O{\ekdverseindentlength}}{ +\NewDocumentEnvironment{ekdverse}{!O{\ekdverseindentlength}}{ \begin{list}{}{% \setlength{\leftmargin}{#1} \setlength{\itemsep}{0pt} @@ -1189,7 +1348,21 @@ \item[] }{\end{list}} \fi +\NewDocumentCommand{\resetvlinenumber}{O{1}}{% + \if@pkg@poetry@verse + \setverselinenums{#1}{0}% + \fi +} +\ekvdefinekeys{ekd@stanza}{ + code type = \def\type@value{#1} +} +\NewDocumentEnvironment{ekdstanza}{!O{}}{% + \leavevmode\unskip + \ekvset{ekd@stanza}{#1}% + \ignorespaces +}{} \NewDocumentEnvironment{ekdpar}{}{\par}{\par} +\IfFileExists{\jobname-ekd.cfg}{\input{\jobname-ekd.cfg}}{} \endinput %% %% End of file `ekdosis.sty'. |