Debian Codegraph @

texmf-dist/source/lualatex/ekdosis/ekdosis.dtx

raw
1 % \iffalse meta-comment
2 %
3 % ekdosis -- Typesetting TEI xml-compliant critical editions
4 % Copyright (C) 2020--2021 Robert Alessi
5 %
6 % Please send error reports and suggestions for improvements to Robert
7 % Alessi <[email protected]>
8 %
9 % This program is free software: you can redistribute it and/or modify
10 % it under the terms of the GNU General Public License as published by
11 % the Free Software Foundation, either version 3 of the License, or
12 % (at your option) any later version.
13 %
14 % This program is distributed in the hope that it will be useful, but
15 % WITHOUT ANY WARRANTY; without even the implied warranty of
16 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 % General Public License for more details.
18 %
19 % You should have received a copy of the GNU General Public License
20 % along with this program. If not, see
21 % <http://www.gnu.org/licenses/>.
22 %
23 %<*internal>
24 \iffalse
25 %</internal>
26 %<*luapre>
27 --[[
28 This file is part of the `ekdosis' package
29
30 ekdosis -- Typesetting TEI xml-compliant critical editions
31 Copyright (C) 2020--2021 Robert Alessi
32
33 Please send error reports and suggestions for improvements to Robert
34 Alessi <[email protected]>
35
36 This program is free software: you can redistribute it and/or modify
37 it under the terms of the GNU General Public License as published by
38 the Free Software Foundation, either version 3 of the License, or
39 (at your option) any later version.
40
41 This program is distributed in the hope that it will be useful, but
42 WITHOUT ANY WARRANTY; without even the implied warranty of
43 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
44 General Public License for more details.
45
46 You should have received a copy of the GNU General Public License
47 along with this program. If not, see
48 <http://www.gnu.org/licenses/>.
49 --]]
50
51 %</luapre>
52 %<*internal>
53 \fi
54 %</internal>
55 % \fi
56 %
57 % \iffalse
58 %<*driver>
59 \ProvidesFile{ekdosis.dtx}
60 %</driver>
61 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
62 %<package>\ProvidesPackage{ekdosis}
63 %<*package>
64 [2021/11/21 v1.4 Typesetting TEI xml-compliant critical editions]
65 %</package>
66 %<*driver>
67 \begin{filecontents}[noheader,overwrite]{bibdata.xml}
68 <?xml version="1.0" encoding="utf-8"?>
69 <listBibl xmlns="http://www.tei-c.org/ns/1.0">
70 <biblStruct type="book" xml:id="ReynoldsWilson1991">
71 <monogr>
72 <title level="m">Scribes and Scholars</title>
73 <author>
74 <forename>L. D.</forename>
75 <surname>Reynolds</surname>
76 </author>
77 <author>
78 <forename>N. G.</forename>
79 <surname>Wilson</surname>
80 </author>
81 <edition>3</edition>
82 <imprint>
83 <pubPlace>Oxford</pubPlace>
84 <publisher>Clarendon Press</publisher>
85 <date>1991</date>
86 </imprint>
87 </monogr>
88 </biblStruct>
89 <biblStruct type="book" xml:id="sDrak">
90 <monogr>
91 <title level="m">Punicorum libri septemdecim</title>
92 <author>
93 <forename>Tiberius Catius</forename>
94 <surname>Silius Italicus</surname>
95 </author>
96 <editor>
97 <forename>Arnold</forename>
98 <surname>Drakenborch</surname>
99 </editor>
100 <edition>Trajecti ad Rhenum</edition>
101 <imprint>
102 <pubPlace>Utrecht</pubPlace>
103 <date>1717</date>
104 </imprint>
105 </monogr>
106 </biblStruct>
107 <biblStruct type="book" xml:id="shGildon1710">
108 <monogr>
109 <title level="m">Works of Mr. William Shakespeare</title>
110 <editor>
111 <forename>Charles</forename>
112 <surname>Gildon</surname>
113 </editor>
114 <imprint>
115 <biblScope unit="volume">17</biblScope>
116 <publisher>E. Curl and E. Sanders</publisher>
117 <date>1710</date>
118 </imprint>
119 </monogr>
120 </biblStruct>
121 <biblStruct type="book" xml:id="shGildon1714">
122 <monogr>
123 <title level="m">Works of Mr. William Shakespeare</title>
124 <editor>
125 <forename>Charles</forename>
126 <surname>Gildon</surname>
127 </editor>
128 <edition>2</edition>
129 <imprint>
130 <biblScope unit="volume">17</biblScope>
131 <publisher>E. Curl and E. Sanders</publisher>
132 <date>1714</date>
133 </imprint>
134 </monogr>
135 </biblStruct>
136 <biblStruct type="book" xml:id="shSewell1725">
137 <monogr>
138 <title level="m">Venus and Adonis, Tarquin and Lucrece, and Mr. Shakespeare's Miscellany Poems</title>
139 <editor>
140 <name>Sewell</name>
141 </editor>
142 <imprint>
143 <publisher>A. Bettesworth</publisher>
144 <date>1725</date>
145 </imprint>
146 </monogr>
147 </biblStruct>
148 <biblStruct type="book" xml:id="shEwing1771">
149 <monogr>
150 <title level="m">Poems, containing I. Venus and Adonis... IV. Sonnets</title>
151 <author>
152 <forename>William</forename>
153 <surname>Shakespeare</surname>
154 </author>
155 <editor>
156 <forename>T.</forename>
157 <surname>Ewing</surname>
158 </editor>
159 <imprint>
160 <pubPlace>Dublin</pubPlace>
161 <date>1771</date>
162 </imprint>
163 </monogr>
164 </biblStruct>
165 <biblStruct type="book" xml:id="shHudson1856">
166 <monogr>
167 <title level="m">Works of W. Shakespeare</title>
168 <editor>
169 <forename>H. N.</forename>
170 <surname>Hudson</surname>
171 </editor>
172 <imprint>
173 <pubPlace>Boston</pubPlace>
174 <publisher>Munroe</publisher>
175 <date>1856</date>
176 </imprint>
177 </monogr>
178 </biblStruct>
179 <biblStruct type="book" xml:id="shWalsh1908">
180 <monogr>
181 <title level="m">Shakespeare's Complete Sonnets</title>
182 <editor>
183 <forename>C. M.</forename>
184 <surname>Walsh</surname>
185 </editor>
186 <imprint>
187 <date>1908</date>
188 </imprint>
189 </monogr>
190 </biblStruct>
191 <biblStruct type="book" xml:id="shButler1899">
192 <monogr>
193 <title level="m">Shakespeare's Sonnets</title>
194 <editor>
195 <forename>Samuel</forename>
196 <surname>Butler</surname>
197 </editor>
198 <imprint>
199 <publisher>Fifield</publisher>
200 <date>1899</date>
201 </imprint>
202 </monogr>
203 </biblStruct>
204 </listBibl>
205 \end{filecontents}
206 \begin{filecontents}[overwrite]{\jobname.bib}
207 @Article{Alessi2020,
208 author = {Alessi, Robert},
209 title = {ekdosis: Using Lua\LaTeX{} for Producing \texttt{TEI
210 xml}-Compliant Critical Editions and Highlighting
211 Parallel Writings},
212 journaltitle = {Journal of Data Mining and Digital Humanities},
213 date = {2020-11},
214 issuetitle = {Collecting, Preserving, and Disseminating Endangered
215 Cultural Heritage for New Understandings through
216 Multilingual Approaches},
217 eprinttype = {jdmdh},
218 eprint = {6536}
219 }
220
221 @Book{Caesar-BG-v2,
222 author = {{Caesar}},
223 title = {Gallic War},
224 origtitle = {Guerre des Gaules},
225 date = 1987,
226 origdate = 1926,
227 editor = {Constans, L.-A.},
228 volume = 2,
229 pagination = {none},
230 series = {Collection des Universités de France},
231 publisher = {Les Belles Lettres},
232 location = {Paris}
233 }
234
235 @Book{CaesarTr,
236 author = {{Caesar}},
237 title = {Gallic War},
238 date = 1869,
239 editor = {McDevitte, W. A., and Bohn, W. S.},
240 edition = 1,
241 series = {Harper's New Classical Library},
242 publisher = {Harper \& Brothers},
243 location = {New York}}
244
245 @MVBook{HomerMurray,
246 author = {{Homer}},
247 title = {The Odyssey},
248 date = 1919,
249 editor = {Murray, A. T.},
250 volumes = 2,
251 publisher = {Harvard University Press -- William Heinemann},
252 location = {Cambridge, MA. -- London}
253 }
254
255 @Book{McDonald1916,
256 editor = {MacDonald Alden, Raymond},
257 shorteditor = {MacDonald},
258 title = {The Sonnets of Shakespeare},
259 date = 1916,
260 titleaddon = {From the Quarto of 1609 with Variorum Readings and
261 Commentary},
262 organization = {Houghton Mifflin Co.},
263 publisher = {The Riverside Press Cambridge},
264 options = {useauthor=false, useeditor=true},
265 location = {Boston \& New York}
266 }
267
268 @Book{ReynoldsWilson1991,
269 author = {Reynolds, L. D. and Wilson, N. G.},
270 title = {Scribes and Scholars},
271 year = {1991},
272 subtitle = {A Guide to the Translation of Greek and Latin
273 Literature},
274 edition = {3},
275 publisher = {Clarendon Press},
276 location = {Oxford}
277 }
278
279 @Book{West1973,
280 author = {West, Martin L.},
281 title = {Textual Criticism and Editorial Technique},
282 date = 1973,
283 titleaddon = {Applicable to Greek and Latin Texts},
284 publisher = {B. G. Teubner},
285 location = {Stuttgart}
286 }
287
288 @Online{DLL-TC,
289 author = {{Digital Latin Library}},
290 title = {Textual Criticism},
291 url =
292 {https://digitallatin.org/library-digital-latin-texts/textual-criticism},
293 urldate = {2020-05-24}
294 }
295
296 @Online{Mastronarde.Tarrant2017,
297 author = {Mastronarde, Donald J. and Tarrant, Richard J.},
298 title = {Review: Guidelines for Encoding Critical Editions
299 for the Library of Digital Latin Texts},
300 date = {2017-12-04},
301 url =
302 {https://classicalstudies.org/scs-blog/donald-j-mastronarde/review-guidelines-encoding-critical-editions-library-digital-latin},
303 organization = {Society for Classical Studies}
304 }
305
306 @Online{TBE,
307 author = {Van den Branden, Ron and Terras, Melissa and
308 Vanhoutte, Edward},
309 title = {TEI by Example},
310 urldate = {2020-08-04},
311 url = {http://www.teibyexample.org}
312 }
313
314 @Software{babel,
315 title = {The Babel package},
316 titleaddon = {Multilingual support for Plain TeX or LaTeX},
317 author = {Bezos López, Javier and Braams, Johannes L.},
318 url = {http://www.ctan.org/pkg/babel},
319 date = {2020-07-13},
320 version = {3.47}
321 }
322
323 @Software{extdash,
324 title = {The Extdash package},
325 titleaddon = {A range of dash commands for compound words},
326 author = {Rozhenko, Alexander I.},
327 url = {http://www.ctan.org/pkg/extdash},
328 date = {2018-06-24},
329 version = {1.3}
330 }
331
332 @Software{fnpos,
333 title = {The Fnpos package},
334 titleaddon = {Control the position of footnotes on the page},
335 author = {Nakashima, Hiroshi},
336 url = {http://www.ctan.org/pkg/fnpos},
337 date = {2018-09-03},
338 version = {1.0}
339 }
340
341 @Software{keyfloat,
342 title = {The Keyfloat package},
343 subtitle = {Provides a key/value interface for generating
344 floats},
345 author = {Dunn, Brian},
346 url = {https://ctan.org/pkg/keyfloat},
347 date = {2021-06-29},
348 version = {2.06},
349 }
350
351 @Software{lineno,
352 title = {The Lineno package},
353 titleaddon = {Line numbers on paragraphs},
354 author = {Lück, Uwe and Böttcher, Stephan},
355 url = {http://www.ctan.org/pkg/lineno},
356 date = {2005-11-02},
357 version = {4.41}
358 }
359
360 @Software{memoir,
361 title = {The Memoir package},
362 titleaddon = {Typeset fiction, non-fiction and mathematical books},
363 author = {Madsen, Lars and Wilson, Peter R.},
364 url = {http://www.ctan.org/pkg/memoir},
365 date = {2021-03-23},
366 version = {3.7o}
367 }
368
369 @Software{paracol,
370 title = {The Paracol package},
371 titleaddon = {Multiple columns with texts “in parallel”},
372 author = {Nakashima, Hiroshi},
373 url = {http://www.ctan.org/pkg/paracol},
374 date = {2018-12-31},
375 version = {1.35}
376 }
377
378 @Software{polyglossia,
379 title = {The Polyglossia package},
380 titleaddon = {An alternative to babel for XeLaTeX and LuaLaTeX},
381 author = {Charette, François and Reutenauer, Arthur},
382 url = {http://www.ctan.org/pkg/polyglossia},
383 date = {2020-04-08},
384 version = {1.49}
385 }
386
387 @Software{tcolorbox,
388 title = {The Tcolorbox package},
389 subtitle = {Coloured boxes, for LaTeX examples and theorems,
390 etc},
391 author = {Sturm, Thomas F.},
392 url = {https://ctan.org/pkg/tcolorbox},
393 date = {2021-06-14},
394 version = {4.51},
395 }
396
397 @Software{titleps,
398 title = {The Titleps package},
399 titleaddon = {Page style control},
400 author = {Bezos López, Javier},
401 url = {https://ctan.org/pkg/titleps},
402 date = {2019-10-16},
403 version = {2.13}
404 }
405
406 @Software{verse,
407 title = {The Verse package},
408 titleaddon = {Aids for typesetting simple verse},
409 author = {Wilson, Peter R. and Robertson, Will},
410 url = {http://www.ctan.org/pkg/verse},
411 date = {2014-05-10},
412 version = {2.4b}
413 }
414
415 @Software{arabluatex,
416 title = {The Arabluatex package},
417 titleaddon = {ArabTeX for LuaLaTeX},
418 author = {Alessi, Robert},
419 url = {http://ctan.org/pkg/arabluatex},
420 date = {2020-03-23},
421 version = {1.20}
422 }
423
424 @Software{icite,
425 title = {The Icite package},
426 titleaddon = {Indices locorum citatorum},
427 author = {Alessi, Robert},
428 url = {http://ctan.org/pkg/icite},
429 date = {2020-03-05},
430 version = {1.3a}
431 }
432
433 @Software{arabtex,
434 title = {The Arabtex package},
435 titleaddon = {Macros and fonts for typesetting Arabic},
436 author = {Lagally, Klaus},
437 url =
438 {http://baobab.informatik.uni-stuttgart.de/ifi/bs/research/arab_e.html},
439 date = {2004-03-11},
440 version = {4.00}
441 }
442 \end{filecontents}
443 \begin{filecontents}[overwrite]{\jobname-ekd.cfg}
444 %% fixfoot:---
445 \DeclareFixedFootnote{\seeekdsep}{See below
446 \vpageref{ref:ekdsep-subsep} for more information and
447 \vref{lst:emend-coni-corr}, ll.~23--5 for an illustrative example.}
448 %% ekdosis:---
449 \footnotelayout{m}
450 \SetCritSymbols{suppbegin = ⟨,suppend = ⟩}
451 \EnvtoTEI{ancientgreek}{p}[xml:lang="grc"]
452 \DeclareApparatus{fontium}[
453 delim=\hskip0.75em,
454 bhook=\textbf{Sources:}]
455 \DeclareApparatus{default}[
456 delim=\hskip0.75em]
457 \DeclareApparatus{ltr}[
458 delim=\hskip0.75em]
459 \DeclareApparatus{rtl}[
460 direction=RL,
461 delim=\hskip0.75em]
462 \DeclareWitness{M}{M}{\emph{Marcianus Gr.} 269}[
463 settlement=Venice,
464 institution=Marciana Library,
465 msName=Marcianus Gr.,
466 idno=269,
467 origDate=s. X]
468 \DeclareHand{M1}{M}{M\textsuperscript{1}}[Emendatio scribae ipsius]
469 \DeclareHand{M2}{M}{M\textsuperscript{2}}[Manus posterior]
470 % Peter and John Story:
471 \DeclareWitness{pjA}{A}{Manuscript A Call No 123}
472 \DeclareWitness{pjB}{B}{Manuscript B Call No 456}
473 \DeclareWitness{pjC}{C}{Manuscript C Call No 789}
474 % Caesar's Gallic War:
475 \DeclareWitness{cA}{A}{\emph{Bongarsianus} 81}[
476 msName=Bongarsianus,
477 settlement=Amsterdam,
478 idno=81,
479 institution=University Library,
480 origDate=s. IX--X]
481 \DeclareHand{cA1}{cA}{A\textsuperscript{1}}[\emph{Emendationes
482 scribae ipsius}]
483 \DeclareWitness{cM}{M}{\emph{Parisinus Lat.} 5056}[
484 origDate={s. XII}]
485 \DeclareWitness{cB}{B}{\emph{Parisinus Lat.} 5763}[
486 origDate={s. IX--X}]
487 \DeclareWitness{cR}{R}{\emph{Vaticanus Lat.} 3864}[
488 origDate={s. X}]
489 \DeclareWitness{cS}{S}{\emph{Laurentianus} R 33}[
490 origDate={s. X}]
491 \DeclareWitness{cL}{L}{\emph{Londinensis} Br. Mus. 10084}[
492 origDate={s. XI}]
493 \DeclareWitness{cN}{N}{\emph{Neapolitanus} IV, c. 11}[
494 origDate={s. XII}]
495 \DeclareWitness{cT}{T}{\emph{Parisinus Lat.} 5764}[
496 origDate={s. XI}]
497 \DeclareWitness{cf}{\emph{f}}{\emph{Vindobonensis} 95}[
498 origDate={s. XII}]
499 \DeclareWitness{cU}{U}{\emph{Vaticanus Lat.} 3324}[
500 origDate={s. XI}]
501 \DeclareWitness{cl}{\emph{l}}{\emph{Laurentianus} Riccard. 541}[
502 origDate={s. XI--XII}]
503 \DeclareShorthand{ca}{α}{cA,cM,cB,cR,cS,cL,cN}
504 \DeclareShorthand{cb}{β}{cT,cf,cU,cl}
505 % Hippocrates Epidemics, Book 2:
506 \DeclareWitness{hV}{V}{\emph{Vaticanus Gr.} 276}
507 \DeclareWitness{hI}{I}{\emph{Parisinus Gr.} 2140}
508 \DeclareHand{hIac}{hI}{I\textsuperscript{ac}}[Lectio ante correctionem]
509 \DeclareHand{hIpc}{hI}{I\textsuperscript{pc}}[Lectio post correctionem]
510 \DeclareWitness{hR}{R}{\emph{Vaticanus Gr.} 277}
511 \DeclareWitness{hH}{H}{\emph{Parisinus Gr.} 2142}
512 \DeclareWitness{hGalE1.Q}{Gal.E1(Q)}{\emph{Parisinus Gr.}
513 2174}[origDate=s. XIV]
514 \DeclareWitness{hGalE1.M}{Gal.E1(M)}{\emph{Monacencis Gr.}
515 231}[origDate=s. XVI]
516 \DeclareShorthand{hGalE1.M.Q}{Gal.E1(MQ)}{hGalE1.M,hGalE1.Q}
517 \DeclareSource{Lit}{Littré}
518 \DeclareSource{Erm}{Ermerins}
519 \DeclareSource{Sm}{Smith}
520 \DeclareSource{Gal}{Gal.}
521 \DeclareScholar{ego}{ego}[
522 forename=Robert,
523 surname=Alessi]
524 \DeclareShorthand{egomute}{\unskip}{ego}
525 \DeclareShorthand{hcodd}{codd.}{hV,hI,hR,hH}
526 \DeclareShorthand{hedd}{edd.}{Lit,Erm,Sm}
527 \DeclareShorthand{hegoscr}{\emph{scripsi}}{ego}
528 % Silius Italicus' Punica, IX, 30--2:
529 \DeclareWitness{sL}{L}{Laurentianus, plut, XXXVII, cod. 16}[
530 origDate=s. XV]
531 \DeclareWitness{sF}{F}{Florentianus, Bibl. Aed. Fl. Eccl. CXCVI}[
532 origDate=s. XV]
533 \DeclareWitness{sO}{O}{Oxoniensis Collegii Reginensis CCCXIV}[
534 origDate=s. XV]
535 \DeclareWitness{sV}{V}{Vaticanus lat. 1652}[
536 origDate=s. XV]
537 \DeclareSource{sDrak}{\emph{Drakenborch}}
538 % Homer, Odyssey
539 \DeclareScholar{hZen}{Zen.}[rawname=Zenodotus]
540 % Shakespeare's Sonnets:
541 \NewDocumentEnvironment{ekdcenter}{}{\par\centering}{\nobreak\par}
542 \NewDocumentCommand{\ekdlettrine}{mm}{%
543 \adjustbox{valign=t,raise=-0.75ex}{\Huge #1}\textsc{#2}%
544 }
545 \TeXtoTEIPat{\ekdlettrine {#1}{#2}}{<hi rend="smallcaps">#1#2</hi>}
546 \DeclareSource{shGildon1710}{G}
547 \DeclareSource{shGildon1714}{G\textsuperscript{2}}
548 \DeclareSource{shSewell1725}{S}
549 \DeclareSource{shEwing1771}{E}
550 \DeclareSource{shHudson1856}{Hu\textsuperscript{2}}
551 \DeclareSource{shButler1899}{But}
552 \DeclareSource{shWalsh1908}{Wa}
553 \DeclareScholar{shGod}{Godwin}[rawname=Godwin]
554 \DeclareScholar{shStee}{Stee}[rawname=Steevens, note=Notes in Malone]
555 \end{filecontents}
556 \documentclass{ltxdoc}
557 %\usepackage[letterpaper,margin=25mm,left=50mm,nohead]{geometry}
558 \usepackage[letterpaper,margin=1.25in,left=50mm,nohead]{geometry}
559 \usepackage{dox}
560 \doxitem{Option}{option}{options}
561 \usepackage{microtype}
562 \usepackage[no-math]{fontspec}
563 \defaultfontfeatures{Renderer=Harfbuzz}
564 \usepackage[latin.classic,greek.ancient,american]{babel}
565 \babelfont{rm}{Old Standard}
566 \babelfont{sf}{NewCMSans10-Book}
567 \babelfont{tt}{NewCMMono10-Book}
568 \babelfont[greek]{rm}[
569 Script=Greek,
570 RawFeature={+ss05;+ss06}
571 ]{Old Standard}
572 \babelfont[greek]{sf}[Script=Greek]{NewCMSans10-Book}
573 \babelfont[greek]{tt}[Script=Greek]{NewCMMono10-Book}
574 \newfontfamily{\junicode}{Junicode}[
575 Ligatures=TeX,
576 RawFeature={+hist}]
577 \newfontfamily\missaali{Missaali Regular}
578 \babeltags{ancientgreek = greek}
579 \def\sg#1{\textancientgreek{#1}}
580 \usepackage[Old Standard]{mathfont}
581 \usepackage[biblatex=true]{embrac}
582 \usepackage{chifoot}
583 \usepackage{fixfoot}
584 \usepackage[nospace,american]{varioref}
585 \newcommand\phts{\phantomsection}
586 \usepackage{nameref}
587 \usepackage{arabluatex}
588 \usepackage[parnotes=roman, teiexport=tidy, poetry=verse]{ekdosis}
589 \AddxmlBibResource{bibdata.xml}
590 \usepackage{booktabs}
591 \usepackage{xltabular}
592 \usepackage[prevent-all]{widows-and-orphans}
593 \usepackage[shortcuts,nospacearound]{extdash}
594 \usepackage[american]{isodate}
595 \usepackage{nextpage}
596 \usepackage{spacingtricks}
597 \usepackage{csquotes}
598 \usepackage{relsize}
599 \usepackage{enumitem}
600 \setlist{nosep}
601 \setlist[itemize]{label=\textendash}
602 \setlist[enumerate,1]{label=(\alph*)}
603 \newlist{remarks}{enumerate}{10}
604 \setlist[remarks]{
605 label*=\textsc{Rem.} \arabic*,
606 left=0.25in,
607 before=\smaller}
608 \usepackage{manfnt}
609 \usepackage{lettrine}
610 \newcommand\danger{\lettrine[loversize=-.5]{\textdbend}{\hskip6pt}}
611 \newcommand\mansee{\lettrine[loversize=-.4,
612 lraise=.55]{\mantriangleright}{\hskip6pt}}
613 \usepackage{metalogox}
614 \usepackage{hologo}
615 \usepackage{xcolor}
616 \newbool{nocolordoc}
617 \definecolor{ekdcolor}{RGB}{243,241,235}
618 \definecolor{cinnamon}{rgb}{0.82, 0.41, 0.12}
619 \ifbool{nocolordoc}{
620 \colorlet{ekdcolor}{white}
621 \colorlet{cinnamon}{black}}{}
622 \definecolor{gainsboro}{RGB}{222,222,222}
623 \PassOptionsToPackage{bookmarks=true}{hyperref}
624 \usepackage[obeyspaces]{url}
625 \usepackage[numbered]{hypdoc}
626 \usepackage[titlematter,loadlang=en|de|fr|es]{metastr}
627 \hypersetup{
628 colorlinks,
629 allcolors=cinnamon,
630 linktocpage=true,
631 pdftype={Text}
632 }
633 \usepackage{uri}
634 \labelformat{section}{sect.~#1}
635 \labelformat{subsection}{sect.~#1}
636 \labelformat{subsubsection}{sect.~#1}
637 \labelformat{figure}{fig.~#1}
638 \usepackage[defaultindex=none,citecmd=autocite]{icite}
639 \bibinput{ekdosis}
640 \newcommand\vnref[1]{\vref{#1}, \enquote{\nameref{#1}}}
641 \usepackage[style=oxnotes-inote,dashed]{biblatex}
642 \DefineBibliographyStrings{english}{
643 seenote={cf\adddotspace n\adddotspace}}
644 \DeclareSourcemap{
645 \maps[datatype=bibtex]{
646 \map{
647 \step[fieldsource=issuetitle]
648 \step[fieldset=journalsubtitle,origfieldval]
649 }
650 }
651 }
652 % include seenote in parentheses
653 \renewbibmacro*{footcite:note}{%
654 \ifnameundef{labelname}
655 {\printfield{label}}
656 {\printnames{labelname}}%
657 \ifsingletitle
658 {}
659 {\setunit*{\printdelim{nametitledelim}}%
660 \printfield[title]{labeltitle}}%
661 \setunit*{\addspace}%
662 \printtext{%
663 \mkbibparens{%
664 \bibstring{seenote}\addnbspace
665 \ref{cbx@\csuse{cbx@f@\thefield{entrykey}}}%
666 \iftoggle{cbx:pageref}
667 {\ifsamepage{\the\value{instcount}}
668 {\csuse{cbx@f@\thefield{entrykey}}}
669 {}
670 {\addcomma\space\bibstring{page}\addnbspace
671 \pageref{cbx@\csuse{cbx@f@\thefield{entrykey}}}}}
672 {}}}}
673 \ifbool{nocolordoc}
674 {
675 \usepackage{academicons}
676 \def\oasymbol{\aiOpenAccess}
677 \usepackage{biblatex-ext-oa}
678 }
679 {\usepackage[symbolpackage=tikz]{biblatex-ext-oa}}
680 \DeclareDelimFormat[bib,biblist]{nametitledelim}{\addcomma\space}
681 \DeclareDelimFormat[bib,biblist]{innametitledelim}{\addcomma\space}
682 \renewcommand*\newunitpunct{\addcomma\space}
683 \newcommand*{\halurl}[1]{http://hal.archives-ouvertes.fr/#1}
684 \DeclareFieldFormat{eprint:hal}{%
685 \ifhyperref
686 {\href{\halurl{#1}}{hal:~\nolinkurl{#1}}}
687 {hal:~\nolinkurl{#1}}}
688 \DeclareFieldAlias{eprint:HAL}{eprint:hal}
689 \DeclareOpenAccessEprintUrl[always]{hal}{%
690 http://hal.archives-ouvertes.fr/\thefield{eprint}}
691 \DeclareOpenAccessEprintAlias{HAL}{hal}
692 \newcommand*{\jdmdhurl}[1]{https://jdmdh.episciences.org/#1}
693 \DeclareFieldFormat{eprint:jdmdh}{%
694 \ifhyperref
695 {\href{\jdmdhurl{#1}}{jdmdh:~\nolinkurl{#1}}}
696 {jdmdh:~\nolinkurl{#1}}}
697 \DeclareFieldAlias{eprint:JDMDH}{eprint:jdmdh}
698 \DeclareOpenAccessEprintUrl[always]{jdmdh}{%
699 https://jdmdh.episciences.org/\thefield{eprint}}
700 \DeclareOpenAccessEprintAlias{JDMDH}{jdmdh}
701 \addbibresource{ekdosis.bib}
702 \metaset{titletext}{%
703 \metapick[#1]{title}%
704 \metacompose[#1]{subtitle}{\metaget[sep]{subtitle}}{}{}}
705 \metaset[print]{titletext}{%
706 \metatitleline[print]{title}%
707 \metatitleline[print]{subtitle}%
708 \metatitleline[print]{author}%
709 \metatitleline[print]{contactemail}%
710 \metatitlelinetwo[print]{date}[print]{draft}}
711 \metaset[skip]{subtitle}{\vspace{1ex}}
712 \metaset[skip]{author}{\vspace{2ex}}
713 \metaset[skip]{date}{\vspace{1ex}}
714 \metaset[style]{title}{\LARGE}
715 \metaset[style]{author}{\large}
716 \metaset[sep]{draft}{ -- }
717 \metasetlang{en-US}
718 \metaset{title}{ἔκδοσις}
719 \metaset{date}{\filedate}
720 \metaset{draft}{\fileversion}
721 \metaset{subject}{TEI xml-compliant critical editions}
722 \metaset{subtitle}{Typesetting TEI xml-Compliant Critical Editions}
723 \metaset[print]{subtitle}{Typesetting \texttt{TEI xml}-Compliant
724 Critical Editions}
725 \metaset{author}{Robert Alessi}
726 \metaset{keywords}{LaTeX, Lua, TEI xml, multilingual critical
727 editions, alignment, segmentation}
728 \metaset{contactemail}{[email protected]}
729 \metaset[print]{contactemail}{\mailto[ekdosis]{[email protected]}}
730 \metaset{contacturl}{http://www.roberalessi.net}
731 \metaset{partof}{The ekdosis Package}
732 \metaset[print]{partof}{The \textsf{ekdosis} Package}
733 \metaset[altlang]{rightstext}{en,de,fr,es}
734 \metaset[fr]{partofmessage}{%
735 Ce document fait partie de l'œuvre: \metapick[#1]{partof}.}
736 \metaset[es]{partofmessage}{%
737 Este documento forma parte de la obra: \metapick[#1]{partof}.}
738 \metaset[es]{licenseurlmessage}{%
739 Para ver una copia de esta licencia, siga el vínculo:
740 \metapick[#1]{licenseurl}.}
741 \metaset{copyrightowner}{\metapick[#1]{author}}
742 \metaset{copyrightdate}{2020--2021}
743 \metaset{licensemessage}{Permission is granted to copy, distribute
744 and/or modify this document under the terms of the GNU Free
745 Documentation License, Version 1.3 or any later version published by
746 the Free Software Foundation; with no Invariant Sections, no
747 Front-Cover Texts, and no Back-Cover Texts. A copy of the license
748 is included in the section entitled ``GNU Free Documentation
749 License''.}
750 \metaset{licenseurl}{https://www.gnu.org/licenses/fdl-1.3.html}
751 \metaset[print]{licenseurl}{%
752 \url{https://www.gnu.org/licenses/fdl-1.3.html}}
753 \metawritepdfinfo
754 \metawritepdfaux
755 \metawritepdfpreamble
756 \metawritepdfcontact
757 \metawritepdfrights
758 \usepackage{multicol}
759 \setlength\IndexMin{100pt}
760 \usepackage{tocloft}
761 \newlistof{listing}{lol}{List of listings}
762 \renewcommand\cfttocprehook{\begin{multicols}{2}}
763 \renewcommand\cfttocposthook{\end{multicols}}
764 \renewcommand\cfttoctitlefont{\Large\bfseries}
765 \renewcommand\cftlolprehook{\begin{multicols}{2}}
766 \renewcommand\cftlolposthook{\end{multicols}}
767 \renewcommand\cftloltitlefont{\Large\bfseries}
768 \usepackage{units}
769 \newcommand*\tred[1]{\textcolor{red}{#1}}
770 \usepackage{fbox}
771 \usepackage{tikz}
772 \usetikzlibrary{tikzmark}
773 \NewDocumentCommand{\pointto}{m}{%
774 \tikz[remember picture] \draw[>->,color=blue,overlay] (0em,0.5ex) to
775 ([shift={(0.5em,0pt)}]pic cs:#1);%
776 \tikz[remember picture] \draw[color=gray, overlay]
777 ([shift={(0.5em,0.5ex)}]pic cs:#1) circle [radius=8pt];}
778 \NewDocumentCommand{\pointtol}{m}{%
779 \tikz[remember picture] \draw[>->,color=blue,overlay] (0em,0.5ex) to
780 [bend left] ([shift={(0.5em,0pt)}]pic cs:#1);%
781 \tikz[remember picture] \draw[color=gray, overlay]
782 ([shift={(0.5em,0.5ex)}]pic cs:#1) circle [radius=8pt];}
783 \NewDocumentCommand{\pointtor}{m}{%
784 \tikz[remember picture] \draw[>->,color=blue,overlay] (0em,0.5ex) to
785 [bend right] ([shift={(0.5em,0pt)}]pic cs:#1);%
786 \tikz[remember picture] \draw[color=gray, overlay]
787 ([shift={(0.5em,0.5ex)}]pic cs:#1) circle [radius=8pt];}
788 \NewDocumentCommand{\pointtoer}{m}{%
789 \tikz[remember picture] \draw[>->,color=blue,overlay] (0em,0.5ex) to
790 [bend right] ([shift={(0em,0pt)}]pic cs:#1);%
791 \tikz[remember picture] \draw[color=gray, overlay]
792 ([shift={(-0.5em,0.5ex)}]pic cs:#1) ellipse [x radius=45pt, y
793 radius=6pt];}
794 \usepackage[breakable, skins, xparse]{tcolorbox}
795 \tcbset{colback=white, boxrule=0.4pt, colframe=cinnamon,
796 breakable}
797 \usepackage[newfloat]{minted}
798 \labelformat{listing}{listing~#1}
799 \ifbool{nocolordoc}{\usemintedstyle{bw}}{}
800 \setminted{bgcolor=ekdcolor,linenos, fontsize=\small}
801 \newminted[ekdlua]{lua}{bgcolor={}, linenos, fontsize=\relsize{-0.5},
802 xleftmargin=12pt, breaklines, numberblanklines=false, numbersep=3pt}
803 \renewcommand{\theFancyVerbLine}{\normalfont\smaller\arabic{FancyVerbLine}}
804 \usepackage[contents]{colordoc}
805 \newcommand{\cls}[1]{\textsf{#1}\index{#1=#1 (class)}}
806 \newcommand{\pkg}[1]{\textsf{#1}\index{#1=#1 (package)}}
807 \newcommand{\env}[1]{\texttt{#1}\index{#1=#1 (environment)}}
808 \backgroundcolor{c}{ekdcolor}
809 \usepackage{caption}
810 \captionsetup[listing]{position=above,skip=-1ex}
811 \usepackage{needspace}
812 \NewDocumentCommand{\captof}{O{listing} m O{}}{%
813 \bgroup
814 \nobreak
815 \vskip 1ex plus 2pt minus 2pt%
816 \captionof{#1}{#2}%
817 #3%
818 \egroup}
819 \NewDocumentCommand{\newfeature}{o}{%
820 \leavevmode
821 \IfNoValueTF{#1}
822 {\marginpar{\hfill\emph{New feature}}}
823 {\marginpar{\hfill\emph{New feature} #1}}%
824 \ignorespaces
825 }
826 % \usepackage{etoc}
827 % \etocsettocdepth{paragraph}
828 % \newcommand{\ekdtableofcontents}{%
829 % \begingroup
830 % \etocsetstyle{section}{}{}
831 % {\etocsavedsectiontocline{%
832 % \numberline{\etocnumber}\etocname}{\etocpage}}{}
833 % \etocsetstyle{subsection}{}{}
834 % {\etocsavedsubsectiontocline{%
835 % \numberline{\etocnumber}\etocname}{\etocpage}}{}%
836 % \etocsetstyle{subsubsection}{}{}
837 % {\etocsavedsubsubsectiontocline{%
838 % \numberline{\etocnumber}\etocname}{\etocpage}}{}%
839 % \etocsetstyle{paragraph}{}{\leftskip2cm\rightskip 2.2em \parfillskip
840 % 0pt plus 1fil\relax \nobreak}
841 % {\noindent\etocname{} \etocpage{} }{\par}%
842 % \etocmulticolstyle[2]{\section*{Contents}}
843 % \pdfbookmark[1]{Contents}{toc}
844 % \tableofcontents
845 % \endgroup}
846 \EnableCrossrefs
847 \CodelineIndex
848 \RecordChanges
849 %\OnlyDescription
850 \begin{document}
851 \DocInput{\jobname.dtx}
852 \PrintChanges
853 \PrintIndex
854 \end{document}
855 %</driver>
856 % \fi
857 %
858 % \CheckSum{2635}
859 %
860 % \CharacterTable
861 % {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
862 % Lower-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
863 % Digits \0\1\2\3\4\5\6\7\8\9
864 % Exclamation \! Double quote \" Hash (number) \#
865 % Dollar \$ Percent \% Ampersand \&
866 % Acute accent \' Left paren \( Right paren \)
867 % Asterisk \* Plus \+ Comma \,
868 % Minus \- Point \. Solidus \/
869 % Colon \: Semicolon \; Less than \<
870 % Equals \= Greater than \> Question mark \?
871 % Commercial at \@ Left bracket \[ Backslash \\
872 % Right bracket \] Circumflex \^ Underscore \_
873 % Grave accent \` Left brace \{ Vertical bar \|
874 % Right brace \} Tilde \~}
875 %
876 % \GetFileInfo{\jobname.dtx}
877 % \DoNotIndex{\newcommand,\newenvironment,\begin,\begingroup}
878 % \DoNotIndex{\bgroup,\def,\edef,\egroup,\else,\expandafter,\endgroup}
879 % \DoNotIndex{\fi,\ifdefined,\luadirect,\luastring,\luastringN}
880 % \DoNotIndex{\luastringO,\NewDocumentCommand,\space,\unexpanded}
881 %
882 % \pdfbookmark[1]{\metaterm{title}}{title}
883 % \begin{tcolorbox}[
884 % colframe=black,
885 % enhanced,
886 % drop lifted shadow,
887 % colback=white,
888 % boxrule=.25mm,
889 % halign=center,
890 % center
891 % ]
892 % \metapick[print]{titletext}
893 % \end{tcolorbox}
894 %
895 % \tableofcontents
896 % \listoflistings
897 %
898 % \changes{v0.99a}{2020/07/08}{First public release (documentation in
899 % progress)}
900 % \changes{v1.0}{2020/08/14}{Documentation complete}
901 %
902 % \begin{abstract}
903 % \pkg{ekdosis} is a Lua\LaTeX{} package designed for
904 % multilingual critical editions. It can be used to typeset texts
905 % and different layers of critical notes in any direction accepted
906 % by Lua\TeX. Texts can be arranged in running paragraphs or on
907 % facing pages, in any number of columns which in turn can be
908 % synchronized or not. In addition to printed texts,
909 % \pkg{ekdosis} can convert \texttt{.tex} source files so as to
910 % produce \texttt{TEI xml}-compliant critical
911 % editions. Database-driven encoding under \LaTeX{} then allows
912 % extraction of texts entered segment by segment according to
913 % various criteria: main edited text, variant readings, translations
914 % or annotated borrowings between texts. It is published under the
915 % terms of the GNU General Public License (GPL) version 3.
916 % \end{abstract}
917 %
918 % \section*{License and Disclaimer}
919 % \addcontentsline{toc}{section}{License and disclamer}
920 % \subsection*{License Applicable to this Document}
921 % \pdfbookmark[2]{Licence applicable to this document}{copyright-doc}
922 % \leavevmode\marginpar{\hfill\texttt{fdl1.3}}
923 % \metapick[print]{rightstext} (See below \vref{sec:fdl}.)
924 %
925 % \subsection*{License Applicable to the Software}
926 % \pdfbookmark[2]{Licence applicable to the software}{copyright-soft}
927 % \label{sec:license-software}
928 %
929 % \pkg{ekdosis} --- \metapick[print]{subtitle}
930 % \metapick[print]{copyrightstatement}
931 %
932 % Please send error reports and suggestions for improvements to Robert
933 % Alessi:
934 % \begin{itemize}
935 % \item email: \mailto[ekdosis package]{Robert Alessi <[email protected]>}
936 % \item website: \url{http://www.ekdosis.org}
937 % \item development: \url{http://git.robertalessi.net/ekdosis}
938 % \item comments, feature requests, bug reports:
939 % \url{http://www.ekdosis.org/issues}
940 % \end{itemize}
941 %
942 % \leavevmode\marginpar{\hfill\texttt{gpl3+}}
943 % This program is free software: you can redistribute it and/or modify
944 % it under the terms of the GNU General Public License as published by
945 % the Free Software Foundation, either version 3 of the License, or
946 % (at your option) any later version.
947 %
948 % This program is distributed in the hope that it will be useful, but
949 % WITHOUT ANY WARRANTY; without even the implied warranty of
950 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
951 % General Public License for more details.
952 %
953 % You should have received a copy of the GNU General Public License
954 % along with this program. If not, see
955 % \href{http://www.gnu.org/licenses}%
956 % {\texttt{<http://www.gnu.org/licenses/>}}.
957 %
958 % This release of \pkg{ekdosis} consists of the following
959 % source files:
960 % \begin{itemize}
961 % \item |ekdosis.ins|
962 % \item |ekdosis.dtx|
963 % \item |ekdosis.el|
964 % \item |Makefile|
965 % \end{itemize}
966 %
967 % \section{Introduction}
968 % \label{sec:introduction}
969 % \begin{comment}
970 % \begin{keyfigure}{l={fig:grid-typesetting},c={Grid Typesetting
971 % (which never came into existence)}, t={Each square in the grid
972 % has a side length of \unit[10]{pt}. Therefore, the distance
973 % between the last line of the text and the first line of the
974 % apparatus is here approximately \unit[25]{pt}.}}
975 % \centering
976 % \begin{tikzpicture}
977 % \draw[gainsboro,thin] (0.5,0.5) grid [step=10pt] (10,5); %
978 % \path node [align=justify, text width=8cm] at (5.5,3) {%
979 % I saw my friend Peter at the station yesterday. We were both
980 % in a great mood. \enquote{How nice to find you here!} he
981 % said. I chuckled to myself, recalling the last time we
982 % met.\par
983 % \rule{3cm}{0.01cm}\par\footnotesize%
984 % \textbf{1}~saw A] met B\hskip1em Peter A] John B \hskip1em
985 % \textbf{2}~great A] good B\hskip1em \textbf{2--3}~How
986 % nice... said A] \emph{om.} B\hskip1em \textbf{4} \emph{post}
987 % met \emph{add.} there B.}; \node at (0,3) {\scriptsize
988 % $\approx$ \unit[25]{pt}}; \draw [->] (0,2.875) -- (0,2.025);
989 % \end{tikzpicture}
990 % \end{keyfigure}
991 % \end{comment}
992 %
993 % \lettrine{\color{cinnamon}\missaali +T+}{he reader} will find here,
994 % by way of introduction, a summarized version of the first part of an
995 % article published in the
996 % \mkbibemph{\citefield{Alessi2020}{journaltitle}} as a contribution
997 % to a Digital Humanities workshop held at Stanford University
998 % (\printdate{2019-04-15}).\footcite{Alessi2020}
999 %
1000 % The name of this package, \pkg{ekdosis}, derives from a Greek
1001 % action noun\---\sg{ἔκδοσις}\---the meaning of which is:
1002 % \enquote{publishing a book}, and also in concrete sense: \enquote{a
1003 % publication, treatise}. For us moderns, this term refers to a long
1004 % tradition of scholarly work consisting in establishing from
1005 % manuscript evidence the texts of Greek and Latin classics that were
1006 % handled down through the Middle Ages to the time of the first
1007 % printed editions. Of course, this definition is extendible to other
1008 % languages as well. The basic premise is that critical editions
1009 % exhibit reconstructed texts from manuscript evidence either under
1010 % the title of the edited text (direct tradition) or from explicit
1011 % citations or parallel passages or translations in other languages
1012 % (indirect tradition).
1013 %
1014 % Whether in print or digital, critical editions come with an
1015 % apparatus criticus in which is mentioned all the evidence that was
1016 % used to build the edited text. Arguably, it is precisely on this
1017 % common point that the two kind of editions part ways for reading a
1018 % traditional, well written apparatus criticus is only meant for
1019 % experienced readers. Getting oneself familiarized with its many
1020 % conventional rules is not unrelated to learning a language, equipped
1021 % with technical terms, grammar rules and style embellishments, which
1022 % came into existence out of over three centuries of scholarly
1023 % attainments. Nevertheless, whereas this language is immediately
1024 % accessible to human mind's ability to use language and interpret
1025 % conventional symbols, it is quite inaccessible to a computer unless
1026 % every item of information has been encoded in the rather dumb format
1027 % that is suited to machines.
1028 %
1029 % On the other hand, editions in print have their own limitations. For
1030 % example, every detail that editors of classical texts decide to
1031 % discard to save space, regardless to its relevance to the purpose of
1032 % the edition, is lost permanently as in the case of dialectal
1033 % coloring of ancient books. Furthermore, passages collected as
1034 % indirect tradition are only available as references in the
1035 % \emph{apparatus testium} and cannot be referred to the original
1036 % text. As a result, the reader is refrained from bestowing attention
1037 % upon major parallel passages to understand better difficult passages.
1038 %
1039 % To conclude on these issues, print publications and digital editions
1040 % are often contrasted as they belonged to two different
1041 % worlds.\footnote{For a good illustration of this point, see
1042 % \cite[\mkbibquote{Content, not Display}]{DLL-TC}.} It is commonly
1043 % said that the content of editions in print is the result of the
1044 % binding of the book itself as an object, whereas digital editions,
1045 % in which format and presentation are by definition separated from
1046 % content, are free from limitations coming from such bindings. To sum
1047 % up from the foregoing considerations, this statement is likely to be
1048 % qualified: as already seen above, the apparatus criticus must be
1049 % looked at as a brilliant production of mind refined by centuries of
1050 % scholarly tradition\---and surely tradition must go on\---arguably
1051 % not as compact paragraphs that require special and painful training
1052 % to be \enquote*{decoded}. On the other hand, what editions in print
1053 % do not provide are what \citename{Mastronarde.Tarrant2017}{author}
1054 % have called \enquote{actionable texts for use in digital research},%
1055 % {\interfootnotelinepenalty=10000\footcite{Mastronarde.Tarrant2017}}
1056 % namely database-driven texts allowing the reader to select
1057 % annotations and display or arrange translations, parallel passages
1058 % or borrowings in a variety of ways.
1059 %
1060 % \pkg{ekdosis} can be seen as an attempt at combining the two
1061 % approaches.
1062 %
1063 % \subsection{Requirements}
1064 % \label{sec:requirements}
1065 % Please refer to \vref{ref:ekdrequirements}.
1066 %
1067 % \subsection{Features}
1068 % \label{sec:features}
1069 % A list of the main features of \pkg{ekdosis} follows:---
1070 % \begin{enumerate}
1071 % \item \phts\label{it:multicol-feature}\emph{Multilingual critical
1072 % editions\/}: \pkg{ekdosis} can be used to typeset any number of
1073 % texts in any direction accepted by \hologo{LuaTeX}. Running
1074 % paragraphs of text can be arranged in any number of columns,
1075 % either on single or facing pages, which in turn can be
1076 % synchronized or not. \pkg{ekdosis} is also suitable for complex
1077 % layouts as in the case of Arabic poetry or images where three-way
1078 % alignment is required, or diagrams, \emph{\&c}.
1079 % \item \phts\label{it:multilayer-feature}\emph{Apparatus criticus\/}:
1080 % Edited texts can receive multiple layers of apparatus, e.g.\
1081 % apparatus criticus (to record variant readings), apparatus fontium
1082 % (to collect references to texts quoted or cited in the edited
1083 % text), apparatus testium (to collect testimonia or parallel
1084 % passages), or any kind of short notes to be printed on the same
1085 % page as the edited text, \emph{\&c}.
1086 % \item \texttt{TEI xml} output: \pkg{ekdosis} can be instructed to
1087 % output both PDF and \texttt{TEI xml} files at the same time.
1088 % \item \emph{Database-driven encoding} under \LaTeX{} of texts
1089 % entered segment by segment allows for alignment of parallel texts
1090 % from multilingual corpora.
1091 % \end{enumerate}
1092 %
1093 % Before going into detail, the following simple example will give the
1094 % reader a general idea of the method of encoding with
1095 % \pkg{ekdosis} authoritative texts composed of lemmata, in a way
1096 % that is very close to \texttt{TEI xml} encoding:---
1097 %
1098 % \captof{The \enquote{Peter/John} basic example}[\label{lst:pj1}]
1099 % \iffalse
1100 %<*example>
1101 % \fi
1102 \begin{minted}{latex}
1103 \begin{ekdosis}
1104 I
1105 \app{
1106 \lem{saw}
1107 \rdg{met}
1108 }
1109 my friend \app{\lem{Peter}\rdg{John}} at the station yesterday.
1110 \end{ekdosis}
1111 \end{minted}
1112 % \iffalse
1113 %</example>
1114 % \fi
1115 %
1116 % PDF output:---
1117 % \medskip
1118 %
1119 % \needspace{7\baselineskip}
1120 % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
1121 % \begin{specimen}
1122 % I
1123 % \app{
1124 % \lem{saw}
1125 % \rdg{met}
1126 % }
1127 % my friend
1128 % \app{
1129 % \lem{Peter}
1130 % \rdg{John}
1131 % }
1132 % at the station yesterday.
1133 % \end{specimen}
1134 % \end{alignment}
1135 %
1136 % \texttt{TEI xml} output:---
1137 % \iffalse
1138 %<*example>
1139 % \fi
1140 \begin{minted}[linenos=false]{xml}
1141 <p>I
1142 <app>
1143 <lem>saw</lem>
1144 <rdg>met</rdg>
1145 </app>my friend
1146 <app>
1147 <lem>Peter</lem>
1148 <rdg>John</rdg>
1149 </app>at the station yesterday.</p>
1150 \end{minted}
1151 % \iffalse
1152 %</example>
1153 % \fi
1154 %
1155 % As can be seen from \vref{lst:pj1}, the edition text is inserted in
1156 % the \env{ekdosis} environment (l.~1 to 8). Then two
1157 % \cs{app}\marg{apparatus entry} commands (ll.~3 and 7) contain the
1158 % lemma (\cs{lem}\marg{lemma}), namely the reading that is accepted by
1159 % the editor, and at least one variant reading
1160 % (\cs{rdg}\marg{reading}, ll.~5 and 7). As the listing shows, the
1161 % editor is free to lay out the code in a legible manner to the eye:
1162 % the first lemma above spans several lines whereas the second one is
1163 % written in sequence without spaces.
1164 %
1165 % In the PDF output, the edition text is printed in the upper part of
1166 % the page, above the line, and naturally shows the accepted
1167 % readings. The margins are used for numeration. In the apparatus
1168 % criticus, below the line, reference to the text is made by
1169 % specifying the number of the line and if several entries refer to
1170 % the same line, numbers are not repeated. Instead, entries are
1171 % separated from one another by a broad horizontal space. Finally, a
1172 % square bracket is used inside entries to distinguish the lemma from
1173 % the variant readings.
1174 %
1175 % Furthermore, as said above, if a \texttt{TEI xml} output be
1176 % required, \pkg{ekdosis} compiles an additional |.xml| file an
1177 % excerpt of which is provided above.
1178 %
1179 % \section{The Basics of \pkg{ekdosis}}
1180 % \label{sec:ekdosis-basics}
1181 %
1182 % \subsection{Loading the Package\---General Options}
1183 % \label{sec:load-general-options}
1184 %
1185 % \pkg{ekdosis} is loaded in the preamble like so:---
1186 % \iffalse
1187 %<*example>
1188 % \fi
1189 \begin{minted}[linenos=false]{latex}
1190 \usepackage{ekdosis}
1191 \end{minted}
1192 % \iffalse
1193 %</example>
1194 % \fi
1195 %
1196 % \pkg{ekdosis} may be loaded with five optional \enquote*{named
1197 % arguments} either of which is set using the syntax
1198 % \meta{key}$=$\meta{value}. The description of the optional arguments
1199 % follows.
1200 %
1201 % \danger The reader is invited to refer to the relevant sections of
1202 % this documentation for more information on how to use these options.
1203 %
1204 % \DescribeOption{layout}\phts\label{ref:layout-opt}
1205 % |layout|$=$\verb+float|footins|keyfloat|fitapp+
1206 % \hfill\tcboxverb{Default: float}
1207 % \begin{enumerate}
1208 % \item |layout=float| By default, layers of critical notes are
1209 % inserted as floating environments to be printed at the bottom of
1210 % the pages.
1211 % \item |layout=footins| This can be set to insert critical notes in
1212 % the default footnote block which can be considered to be a special
1213 % kind of float that is printed at the bottom of the pages. In this
1214 % case, the apparatus criticus will be inserted between regular
1215 % numbered footnotes, but will carry no footnote mark of its own.
1216 % \item \label{ref:keyfloat-opt}\newfeature[v1.3] |layout=keyfloat|
1217 % does approximately the
1218 % same as the default option |layout=float| but uses the
1219 % \pkg{keyfloat} package\footcite{keyfloat} to generate the floating
1220 % environments to be used as containers for critical footnotes. This
1221 % way, the keys and values provided by this
1222 % package\footcite[See][sect. 2.3, \ppno~13--16]{keyfloat} may be
1223 % used to achieve such effects as append additional, informative
1224 % text below the apparatus, draw a line around the apparatus block
1225 % or change its width.\footnote{See below, \vpageref{ref:keyparopts}
1226 % for more information.}
1227 % \item \label{ref:fitapp-opt}\newfeature[v1.3] |layout=fitapp| As
1228 % described below in \vnref{sec:oscillating-problem}, \pkg{ekdosis}
1229 % may oscillate indefinitely between different sets of page
1230 % decisions when one or more apparatus entries attached to the last
1231 % lines of the edition text on a given page do not fit in the
1232 % apparatus block. The reader will find in this section of the
1233 % documentation a detailed account of several ways to circumvent
1234 % this issue. Alternatively, or rather conjointly with those ways,
1235 % |layout=fitapp| can be used to instruct \pkg{ekdosis} to scale
1236 % down the characters of the apparatus block so that the contentious
1237 % entries can fit. This mechanism uses the \enquote{fitting} library
1238 % provided by the \pkg{tcolorbox} package.\footcite[sect.~22,
1239 % \ppno~\pnfmt{438--449}]{tcolorbox} When this option is set, the
1240 % apparatus criticus grows normally until a predefined height is
1241 % reached. This height is set to |0.5\textheight| by
1242 % default.\footnote{Of course, this height can be modified. See
1243 % below \vpageref{ref:appheight} for details.} From this point on,
1244 % the apparatus block ceases to grow; rather, the size of the
1245 % characters is reduced to allow for additional entries. As a
1246 % consequence of this rationale, the total number of entries on a
1247 % given page must not be too high. It is therefore advisable to use
1248 % |layout=fitapp| conjointly with |maxentries| as described below
1249 % \vpageref{ref:maxentries} and in \vref{sec:oscillating-problem}. %
1250 % \danger If used appropriately, this mechanism gives excellent
1251 % typographical results, notably with complex edition texts of which
1252 % the entries in the associated apparatus can be quite abundant in
1253 % number. It may even put an end to the
1254 % \enquote{\hyperref[sec:oscillating-problem]{oscillating problem}}
1255 % in most of the cases. However, as suitable it may be for high
1256 % quality typeset texts and final, camera-ready copies, its benefit
1257 % comes at the expense of slowing down the compilation process. Yet
1258 % looser algorithms can be selected when speed must prevail over
1259 % quality for intermediate or draft copies.\footnote{See below
1260 % \vpageref{ref:fitalgorithm} for more information.}
1261 % \end{enumerate}
1262 %
1263 % \DescribeOption{divs}\phts\label{ref:divs-opt}
1264 % |divs|$=$\verb+ekdosis|latex+\hfill\tcboxverb{Default: ekdosis}\\
1265 % In many occasions, \LaTeX{} standard textual divisions do not meet
1266 % the specific requirements of classical and literary texts, the
1267 % divisions of which may depend on many different received
1268 % traditions. \pkg{ekdosis} provides a flexible mechanism in which
1269 % format and presentation have been carefully separated from
1270 % content. It is designed to build un-numbered \texttt{TEI} divisions
1271 % allowed to nest recursively.\footnote{See below,
1272 % \vref{sec:body-divisions}.} However, if |divs| be set to |latex|,
1273 % \LaTeX{} standard textual divisions can be used and will be
1274 % translated into \texttt{TEI} numbered |<div>| elements.
1275 %
1276 % \danger It must be noted that the two styles are mutually exclusive.
1277 % \vskip\baselineskip
1278 %
1279 % \DescribeOption{poetry}\phts\label{ref:poetry-opt}
1280 % \newfeature[v1.2] |poetry|$=$\verb+verse+
1281 % \hfill\tcboxverb{Default: not set}\\
1282 % |poetry=verse| instructs \pkg{ekdosis} to load and use the facilites
1283 % supplied by the \pkg{verse} package for the typesetting of lines of
1284 % poetry.\footnote{\texttt{verse} does not need to be set if the
1285 % \cls{memoir} class be used. See \vref{sec:verse-package} for more
1286 % detail.} The \env{ekdverse} environment must then be used instead of
1287 % the \env{verse} environment that is provided by the \pkg{verse}
1288 % package as described below in \vref{sec:verse-package}.
1289 %
1290 % \DescribeOption{parnotes}\phts\label{ref:parnotes-opt}
1291 % |parnotes|$=$\verb+true|false|roman+%
1292 % \hfill\tcboxverb{Default: not set}\\
1293 % This named argument does not need a value as it defaults to |true|
1294 % if used. Apparatus criticus typeset by \pkg{ekdosis} may contain
1295 % notes and footnotes. The latter can be laid out as paragraphed notes
1296 % below the block of critical notes by means of the \pkg{parnotes}
1297 % package. Additionally, |parnotes=roman| prints these footnotes
1298 % numbered with Roman numerals.
1299 %
1300 % \DescribeOption{teiexport}\phts\label{ref:teiexport-option}
1301 % |teiexport|$=$\verb+true|false|tidy+%
1302 % \hfill\tcboxverb{Default: not set}\\
1303 % This named argument does not need a value as it defaults to |true|
1304 % if used. If |teiexport| be set to |true|, \pkg{ekdosis} is
1305 % instructed to output both PDF and \texttt{TEI xml} files at the same
1306 % time. By default, the \texttt{TEI} file will receive the same
1307 % basename as the |.tex| source file, suffixed with |-tei.xml|. The
1308 % raw |.xml| file that is produced by \pkg{ekdosis} can be further
1309 % processed by the \textsf{tidy} console application.\footnote{See
1310 % \url{http://www.html-tidy.org}.} To make this happen, \textsf{tidy}
1311 % must be installed and the |.tex| source file must be compiled with
1312 % the |--shell-escape| facility so that spawning programs from
1313 % \LaTeX{} can be allowed.\footnote{See
1314 % \url{https://texfaq.org/FAQ-spawnprog} for more information on how
1315 % to do this.}
1316 %
1317 % As an example, the following line loads \pkg{ekdosis} and instructs
1318 % it to output a \texttt{TEI xml} file (in addition to the PDF one)
1319 % and to use \pkg{parnotes} to format with Roman numerals the footnotes
1320 % that are inserted in the apparatus criticus:---
1321 % \iffalse
1322 %<*example>
1323 % \fi
1324 \begin{minted}[linenos=false]{latex}
1325 \usepackage[teiexport, parnotes=roman]{ekdosis}
1326 \end{minted}
1327 % \iffalse
1328 %</example>
1329 % \fi
1330 %
1331 % \subsection{Setup}
1332 % \label{sec:setup}
1333 % \DescribeMacro{\ekdsetup} \newfeature[v1.3] Starting from v1.3,
1334 % \cs{ekdsetup} can be used to specify options that affect the general
1335 % behavior of \pkg{ekdosis}. \cs{ekdsetup} is a preamble-only
1336 % command. It accepts the following |key=value| options the number of
1337 % which is expected to increase as \pkg{ekdosis} grows:\\
1338 % \DescribeOption{showpagebreaks}\phts\label{ref:showpagebreaks-opt}
1339 % \unskip|showpagebreaks|$=$\verb+true|false+
1340 % \hfill \tcboxverb{Initially: false; Default: true}\\
1341 % This named argument, which defaults to |true| if used without value,
1342 % has specific marks printed in the margins so as to spot with a rapid
1343 % cast of the eye the locations of conditional page breaks generated
1344 % by the \cs{ekdpb} command described below \vpageref{ref:ekdpb}. By
1345 % default, page breaks generated by \cs{ekdpb} are identified by the
1346 % string |spb|\===for \enquote{soft} page break\=== whereas those
1347 % generated by \cs{ekdpb*} are identified by |hpb|\===for
1348 % \enquote{hard} page break. Furthermore, when \cs{ekdpb} triggers no
1349 % page break, the marker is printed between square brackets, like so:
1350 % |[spb]|. In this
1351 % way, inoperative \cs{ekdpb} can be easily spotted and removed.\\
1352 % \DescribeOption{spbmk} |spbmk|$=$\meta{string}
1353 % \hfill\tcboxverb{Default: spb}\\
1354 % |spbmk| is used to change the string associated to \enquote{soft}
1355 % page breaks.\\
1356 % \DescribeOption{hpbmk} |hpbmk|$=$\meta{string}
1357 % \hfill\tcboxverb{Default: hpb}\\
1358 % |hpbmk| is used to change the string associated to \enquote{hard}
1359 % page breaks.
1360 %
1361 % As an example, what follows has \enquote{soft} page breaks printed
1362 % in blue and \enquote{hard} page breaks printed in red:---
1363 %
1364 % \iffalse
1365 %<*example>
1366 % \fi
1367 \begin{minted}[linenos=false]{latex}
1368 \ekdsetup{
1369 showpagebreaks,
1370 spbmk = \textcolor{blue}{spb},
1371 hpbmk = \textcolor{red}{hpb}
1372 }
1373 \end{minted}
1374 % \iffalse
1375 %</example>
1376 % \fi
1377 %
1378 % \subsection{Using a Configuration File}
1379 % \label{sec:using-conf-file}
1380 % Complex editions may use a large number of witnesses, sources and
1381 % scholars. It may also be required to define a multiple-layer
1382 % apparatus criticus, several text environments to be aligned and
1383 % quite a number of new commands. \pkg{ekdosis} provides a convenient
1384 % way to avoid overloading the document preamble: all the settings
1385 % related to the critical edition can be gathered in a separate
1386 % configuration file named |\jobname-ekd.cfg|. If such a file can be
1387 % found, its contents are automatically read and used by
1388 % \pkg{ekdosis}.
1389 %
1390 % \subsection{Witnesses, Hands, Sources, Scholars \& Shorthands}
1391 % \label{sec:declarations}
1392 % \paragraph{Terminology}
1393 % \label{sec:terminology}
1394 % Strictly speaking, the term \enquote{witness} should apply to any
1395 % manuscript evidence dating back to the Middle Ages used by the
1396 % editor to establish the edition text. That said, editors often
1397 % consult many other types of documents, such as modern editions,
1398 % articles, notes, correspondence and the like, all of which fall into
1399 % the category of \enquote{sources}. Furthermore, unpublished
1400 % conjectures are also taken into account, not to mention the
1401 % corrections and emendations that are proposed in many places by the
1402 % editor of the text. As it is necessary to refer to scholars as
1403 % individuals, \enquote{scholars} naturally emerges as a third
1404 % category.
1405 %
1406 % Any reference that is to be used in the apparatus criticus must be
1407 % \enquote{declared} in the preamble beforehand, namely: manuscript
1408 % sigla (either for single manuscripts or manuscript families, primary
1409 % or later hands, \emph{\&c.}), abbreviated last names of sources
1410 % and scholars. To that effect, \pkg{ekdosis} provides the following
1411 % preamble-only commands:---
1412 %
1413 % \paragraph{Witnesses}
1414 % \DescribeMacro{\DeclareWitness} \cs{DeclareWitness}\marg{unique
1415 % id}\marg{rendition}\marg{description}\oarg{options}
1416 % \phts\label{ref:declarewitness}\\
1417 % This command requires three mandatory arguments enclosed between
1418 % curly braces used to specify consecutively:
1419 % \begin{enumerate}
1420 % \item The unique identifier of the witness to be used both in the
1421 % |.tex| source file and as an |xml:id| in the \texttt{TEI xml}
1422 % output if any.\footnote{See \vpageref{ref:xmlid} for more
1423 % information.}
1424 % \item The rendition to be used in the printed apparatus criticus,
1425 % which also will be found within the |<sourceDesc>| element of the
1426 % \texttt{TEI} header where the description of the witness occurs,
1427 % within a |<abbr type="siglum">| element.
1428 % \item A basic description of the manuscript to be found in a typical
1429 % printed Conspectus Siglorum, namely: the name of the manuscript
1430 % followed by its call number.
1431 % \end{enumerate}
1432 % Finally, the optional argument of \cs{DeclareWitness} accepts a
1433 % comma-separated list of the following \enquote{name=value} arguments
1434 % the first six of which are used to collect items of information to
1435 % be found within the |<msIdentifer>| element in the \texttt{TEI}
1436 % header:\footnote{See
1437 % \url{https://tei-c.org/release/doc/tei-p5-doc/en/html/MS.html\#msid}
1438 % for detailed information on these elements.}---\\
1439 % \DescribeOption{settlement} |settlement|$=$\meta{name}: The name of
1440 % a city or administrative unit.\\
1441 % \DescribeOption{institution} |institution|$=$\meta{name}: The name
1442 % of an institution such as a university or library.\\
1443 % \DescribeOption{repository} |repository|$=$\meta{name}: The name of
1444 % the repository within which the witness is stored.\\
1445 % \DescribeOption{collection} |collection|$=$\meta{name}: The name of
1446 % a collection of manuscripts.\\
1447 % \DescribeOption{idno} |idno|$=$\meta{call \#}: Any form of call
1448 % number.\\
1449 % \DescribeOption{msName} |msName|$=$\meta{name}: The name commonly
1450 % used for the witness.\\
1451 % \DescribeOption{origDate} |origDate|$=$\meta{date}: Any form of date
1452 % used to identify the date of origin for the witness.\\
1453 % \DescribeOption{locus} |locus|$=$\meta{locus}\newfeature[v1.3]: The
1454 % sequence of folio references where the edition text is found in the
1455 % manuscript.
1456 %
1457 % \phts\label{ref:marcianus-b}
1458 % To take here one example, a witness such as the \emph{Marcianus
1459 % Graecus}~269, referred to as manuscript \enquote*{M} in the
1460 % editions, which contains sixty treatises transmitted under the name
1461 % of Hippocrates, could be declared as follows:\footnote{The locus
1462 % specified refers to Hippocrates' \emph{Epidemics}, Book~6.}---
1463 %
1464 %\iffalse
1465 %<*example>
1466 % \fi
1467 \begin{minted}[linenos=false]{latex}
1468 \DeclareWitness{M}{M}{\emph{Marcianus Gr.} 269}[
1469 settlement=Venice,
1470 institution=Marciana Library,
1471 msName=Marcianus Gr.,
1472 idno=269,
1473 origDate=s. X,
1474 locus=fol. 416\textsuperscript{v}–426\textsuperscript{v}]
1475 \end{minted}
1476 % \iffalse
1477 %</example>
1478 % \fi
1479 %
1480 % \paragraph{Hands}
1481 % \DescribeMacro{\DeclareHand} \cs{DeclareHand}\marg{unique
1482 % id}\marg{base ms.}\marg{rendition}\oarg{note}\\
1483 % This command requires three mandatory arguments enclosed between
1484 % curly braces and one optional argument between square brackets used
1485 % to specify consecutively:---
1486 % \begin{enumerate}
1487 % \item The unique identifier of the hand to be used both in the
1488 % |.tex| source file and as an |xml:id| in the \texttt{TEI xml} output
1489 % if any.\footnote{See \vpageref{ref:xmlid} for more information.}
1490 % \item The unique identifier of the witness the hand is related
1491 % to. Of course, this witness must have been declared beforehand.
1492 % \item The rendition to be used in the printed apparatus criticus,
1493 % which also will be found within the |<handNote>| element of the
1494 % \texttt{TEI} header where the description of the hand occurs, within
1495 % a |<abbr type="siglum">| element.
1496 % \item Some further information about the hand.
1497 % \end{enumerate}
1498 %
1499 % To continue the preceding example, here is how additions and
1500 % corrections found in the \emph{Marcianus Gr.}~269 could be declared
1501 % after this witness has been declared itself:---
1502 % \iffalse
1503 %<*example>
1504 % \fi
1505 \begin{minted}[linenos=false]{latex}
1506 \DeclareHand{M1}{M}{M\textsuperscript{1}}[Emendatio scribae ipsius]
1507 \DeclareHand{M2}{M}{M\textsuperscript{2}}[Manus posterior]
1508 \end{minted}
1509 % \iffalse
1510 %</example>
1511 % \fi
1512 %
1513 % As can be seen, values such as |M|, |M1| and |M2| in the |.tex|
1514 % source file will be printed as \getsiglum{M}, \getsiglum{M1} and
1515 % \getsiglum{M2} respectively. Not only the code gains legibility, but
1516 % also flexibility for simply changing any declared rendition will
1517 % update corresponding sigla throughout the entire edition.
1518 %
1519 % As a final example, here is how \pkg{ekdosis} would encode
1520 % information as declared above for the \emph{Marcianus Gr.}~269
1521 % should a \texttt{TEI} output be required:---
1522 % \iffalse
1523 %<*example>
1524 % \fi
1525 \begin{minted}[linenos=false]{xml}
1526 <sourceDesc>
1527 <listWit>
1528 <witness xml:id="M">
1529 <abbr type="siglum">M</abbr>
1530 <emph>Marcianus Gr.</emph>269
1531 <msDesc>
1532 <msIdentifier>
1533 <settlement>Venice</settlement>
1534 <institution>Marciana Library</institution>
1535 <idno>269</idno>
1536 <msName>
1537 Marcianus Gr.
1538 </msName>
1539 </msIdentifier>
1540 <physDesc>
1541 <handDesc hands="2">
1542 <handNote xml:id="M1">
1543 <abbr type="siglum">M
1544 <hi rend="sup">1</hi></abbr>
1545 <p>Emendatio scribae ipius</p>
1546 </handNote>
1547 <handNote xml:id="M2">
1548 <abbr type="siglum">M
1549 <hi rend="sup">2</hi></abbr>
1550 <p>Manus posterior</p>
1551 </handNote>
1552 </handDesc>
1553 </physDesc>
1554 <history>
1555 <origin>
1556 <origDate>s. X</origDate>
1557 </origin>
1558 </history>
1559 </msDesc></witness>
1560 </listWit>
1561 </sourceDesc>
1562 \end{minted}
1563 % \iffalse
1564 %</example>
1565 % \fi
1566 % \phts\label{ref:marcianus-e}
1567 %
1568 % \paragraph{Sources}
1569 % \phts\label{ref:declare-source}
1570 % \DescribeMacro{\DeclareSource} \cs{DeclareSource}\marg{unique
1571 % label}\marg{rendition}\newfeature[v1.1]\\
1572 % The \emph{Conspectus Siglorum} that is placed ahead of the edition
1573 % text is traditionally divided into two parts: a)~\emph{Codices},
1574 % which provides the list of sigla used in the apparatus,
1575 % b)~\emph{Editiones uel Studia}, which provides references to
1576 % sources, either published or unpublished, which contain conjectures
1577 % used in the apparatus criticus. \cs{DeclareSource} takes two
1578 % mandatory arguments used to specify consecutively:---
1579 % \begin{enumerate}
1580 % \item A unique label used in the |.tex| source file to refer to the
1581 % work where the conjecture is found.
1582 % \item The rendition to be used in the printed apparatus criticus.
1583 % \end{enumerate}
1584 %
1585 % \danger As \pkg{ekdosis} can include and use \texttt{TEI
1586 % xml}-compliant lists of references,\footnote{See below
1587 % \vref{sec:references-cited-works}.} it is advisable to use
1588 % Bib\hologo{(La)TeX} labels in the first argument of
1589 % \cs{DeclareSource}. Otherwise, the unique label used to declare the
1590 % source would point to no |xml:id| and the \texttt{TEI xml} would not
1591 % be valid. Likewise, shorthands fields from the bibliographical
1592 % database can be recalled from within the second argument of
1593 % \cs{DeclareSource}:---
1594 %
1595 % \iffalse
1596 %<*example>
1597 % \fi
1598 \begin{minted}[linenos=false]{latex}
1599 \DeclareSource{Wil}{Wilamowitz}
1600 % or for example:
1601 \DeclareSource{Wil}{\citename{Wil}{shorteditor}}
1602 \end{minted}
1603 % \iffalse
1604 %</example>
1605 % \fi
1606 % \phts\label{sec:declarations-end}
1607 %
1608 % \paragraph{Scholars}
1609 % \phts\label{ref:declare-scholar}
1610 % \DescribeMacro{\DeclareScholar}\cs{DeclareScholar}\marg{unique
1611 % id}\marg{rendition}\oarg{options}\newfeature[v1.1]\\
1612 % Occasionally, it is necessary to refer to a scholar as a person. For
1613 % example, corrections and conjectures are commonly inserted as
1614 % self-references to the editor of the text in the apparatus criticus
1615 % in print with such words as \emph{scripsi}, \emph{addidi},
1616 % \emph{correxi} and the like. Other examples come from unpublished
1617 % conjectures of other scholars found in private
1618 % libraries. \cs{DeclareScholar} takes two mandatory arguments to
1619 % specify consecutively:---
1620 % \begin{enumerate}
1621 % \item The unique identifier of the scholar to be used both in the
1622 % |.tex| source file and as an |xml:id| in the \texttt{TEI xml} output
1623 % if any.\footnote{See \vpageref{ref:xmlid} for more information.}
1624 % \item The rendition to be used in the apparatus criticus in print,
1625 % which also will be found within the |<sourceDesc>| element of the
1626 % \texttt{TEI} header where the description of the persons cited
1627 % occurs, within an |<abbr type="siglum">| element.
1628 % \end{enumerate}
1629 % Finally, the optional argument of \cs{DeclareScholar} accepts the
1630 % following comma-separated list of |key-value| arguments:---\\
1631 % \DescribeOption{rawname}|rawname|$=$\meta{name}\\
1632 % |rawname| refers to a name that is not to be dissected into name
1633 % part components such as forename, surname and the like. If |rawname|
1634 % be used, then \pkg{ekdosis} will ignore the following three optional
1635 % arguments: |forename|, |surname| and |addname|.\\
1636 % \DescribeOption{forename}|forename|$=$\meta{forename}\\
1637 % |forename| refers to first and middle names or initials.\\
1638 % \DescribeOption{surname}|surname|$=$\meta{surname}\\
1639 % |surname| stores the last name.\\
1640 % \DescribeOption{addname} |addname|$=$\meta{additional name}\\
1641 % |addname| refers to an additional or alternate name by which the
1642 % scholar is known viz.\ a Latinized form of the name, a nickname, an
1643 % epithet or alias.\\
1644 % \DescribeOption{note} |note|$=$\meta{note}\\
1645 % |note| may hold any relevant information about the material used by
1646 % the editor. For example, a note may specify that this material has
1647 % been found as marginal notes by the hand of the scholar in some
1648 % edition in print.
1649 %
1650 % \paragraph{Shorthands}
1651 % \DescribeMacro{\DeclareShorthand} \cs{DeclareShorthand}\marg{unique
1652 % id}\marg{rendition}\marg{csv list of identifiers}\\
1653 % This command provides a convenient way to declare \emph{families} of
1654 % witnesses. It takes three mandatory arguments used to specify
1655 % consecutively:---
1656 % \begin{enumerate}
1657 % \item The unique identifier of the family to be used in the |.tex|
1658 % source file.
1659 % \item The rendition to be used in the printed apparatus criticus.
1660 % \item A comma-separated list of previously declared witnesses.
1661 % \end{enumerate}
1662 %
1663 % As an example, the manuscripts of Caesar's \emph{Gallic War} are
1664 % divided into two families: α, which includes mss.\ A, M, B, R, S, L
1665 % and N, and β, which includes mss.\ T, f, U and l. Therefore,
1666 % provided that all these witnesses have been already declared, here
1667 % is how the two families α and β could be
1668 % declared:\footnote{These witnesses are used in the example
1669 % provided below in \vref{lst:caesar-bg}.}---
1670 % \phts\label{ref:caesar-bg-sigla}
1671 % \iffalse
1672 %<*example>
1673 % \fi
1674 \begin{minted}[linenos=false]{latex}
1675 \DeclareShorthand{a}{α}{A,M,B,R,S,L,N}
1676 \DeclareShorthand{b}{β}{T,f,U,l}
1677 \end{minted}
1678 % \iffalse
1679 %</example>
1680 % \fi
1681 %
1682 % Then, symbols |a| and |b| can be used in the |.tex| source file in
1683 % place of manuscripts that belong to either family.
1684 %
1685 % That said, \cs{DeclareShorthand} is not meant to be restricted to
1686 % declared witnesses. On the contrary, it also applies to any declared
1687 % sources and scholars by means of \cs{DeclareSource} and
1688 % \cs{DeclareScholar}. As an example, assuming that a self-reference
1689 % to the person responsible for the edition has been set in the
1690 % preamble, an associated shorthand can be defined like so:---
1691 %
1692 % \iffalse
1693 %<*example>
1694 % \fi
1695 \begin{minted}{latex}
1696 \DeclareScholar{ego}{ego}[
1697 forename=John,
1698 surname=Smith,
1699 note=Main editor of the text]
1700 \DeclareShorthand{egoscr}{\emph{scripsi}}{ego}
1701 \end{minted}
1702 % \iffalse
1703 %</example>
1704 % \fi
1705 %
1706 % Then, the shorthand |egoscr| (l.~5) can be used to print in the
1707 % apparatus criticus the technical term \emph{scripsi} and use at the
1708 % same time the pointer |#ego| that is expected in the \texttt{TEI
1709 % xml} output file. Detailed examples of this technique will be
1710 % provided below in \vref{sec:emendations-conjectures}.
1711 %
1712 % \subsubsection{Printing Formatted Witnesses
1713 % --- Conspectus Siglorum}
1714 % \label{sec:print-witnesses}
1715 % Once witnesses, hands, scholars and sources have been declared,
1716 % \pkg{ekdosis} provides two commands to have them printed as declared
1717 % from their identifiers.
1718 %
1719 % \DescribeMacro{\getsiglum} \cs{getsiglum}\marg{csv list of witnesses
1720 % or single witness} behaves exactly as the |wit| optional argument of
1721 % \cs{lem} and \cs{rdg} described below on pages~\pageref{ref:lem-wit}
1722 % and \pageref{ref:rdg-wit}. From a single identifier or from a
1723 % comma-separated list of identifiers, it returns their formatted
1724 % counterparts. To return to the example provided
1725 % \vpagerefrange{ref:marcianus-b}{ref:marcianus-e}, |\getsiglum{M}|
1726 % would return \getsiglum{M}, while |\getsiglum{M1}| would return
1727 % \getsiglum{M1}.
1728 %
1729 % \DescribeMacro{\SigLine} \cs{SigLine}\marg{unique id} returns from
1730 % \meta{unique id} used in the first argument of
1731 % \cs{DeclareWitness}\footnote{See above
1732 % \vpageref{ref:declarewitness}.} a line ready to be inserted in a
1733 % table set to print a Conspectus Siglorum with the following items of
1734 % information separated by the symbol |&|: the siglum referring to the
1735 % witness, the contents of the |description| field, followed if
1736 % applicable by the sequence of folios that refers to the edition
1737 % text, and the contents of the |origDate| field. An example of how
1738 % one could print the Conspectus Siglorum of the manuscripts of
1739 % Caesar's \emph{Gallic War} from the list provided
1740 % \vpageref{ref:caesar-bg-sigla} follows:---
1741 %
1742 % \captof{Conspectus Siglorum of Caesar's \emph{Gallic War}}
1743 % \iffalse
1744 %<*example>
1745 % \fi
1746 \begin{minted}[linenos=false]{latex}
1747 \begin{xltabular}[c]{0.75\linewidth}{lXl}
1748 \caption*{\textbf{Conspectus siglorum}}\\
1749 \multicolumn{3}{c}{\emph{Familia} \getsiglum{a}}\\
1750 \SigLine{A}\\
1751 & \getsiglum{A1} \emph{Emendationes scribae ipsius} & \\
1752 \SigLine{M}\\
1753 [...]
1754 \SigLine{N}\\
1755 \multicolumn{3}{c}{\emph{Familia} \getsiglum{b}}\\
1756 \SigLine{T}\\
1757 [...]
1758 \SigLine{l}\\
1759 \end{xltabular}
1760 \end{minted}
1761 % \iffalse
1762 %</example>
1763 % \fi
1764 %
1765 % \begin{xltabular}[c]{0.75\linewidth}{lXl}
1766 % \caption*{\textbf{Conspectus siglorum}}\\
1767 % \multicolumn{3}{c}{\emph{Familia} \getsiglum{ca}}\\
1768 % \SigLine{cA}\\
1769 % & \getsiglum{cA1} \emph{Emendationes scribae ipsius} & \\
1770 % \SigLine{cM}\\
1771 % \SigLine{cB}\\
1772 % \SigLine{cR}\\
1773 % \SigLine{cS}\\
1774 % \SigLine{cL}\\
1775 % \SigLine{cN}\\
1776 % \multicolumn{3}{c}{\emph{Familia} \getsiglum{cb}}\\
1777 % \SigLine{cT}\\
1778 % \SigLine{cf}\\
1779 % \SigLine{cU}\\
1780 % \SigLine{cl}\\
1781 % \end{xltabular}
1782 %
1783 % \subsection{Editing a Single Text}
1784 % \label{sec:single-text-editing}
1785 % \DescribeEnv{ekdosis}
1786 % Running paragraphs of one single text to be edited should be
1787 % inserted in the \env{ekdosis} environment, like so:\footnote{See
1788 % above \vref{lst:pj1}.}---
1789 % \iffalse
1790 %<*example>
1791 % \fi
1792 \begin{minted}[linenos=false]{latex}
1793 \begin{ekdosis}
1794 Edition text goes here.
1795 \end{ekdosis}
1796 \end{minted}
1797 % \iffalse
1798 %</example>
1799 % \fi
1800 %
1801 % \paragraph{Apparatus Entries}
1802 % \DescribeMacro{\app} \cs{app}|[type=|\meta{type}|]|\marg{apparatus
1803 % entries}\phts\label{ref:app-cmd}\\
1804 % This command takes one mandatory argument and accepts one optional
1805 % argument. Once references to be used as witnesses in the apparatus
1806 % criticus have been declared in the preamble as described in
1807 % \ref{sec:declarations}
1808 % \vpagerefrange{sec:declarations}{sec:declarations-end}, the \cs{app}
1809 % command is used for inserting entries in the apparatus criticus,
1810 % either lemmata, readings or notes, like so:---
1811 % \iffalse
1812 %<*example>
1813 % \fi
1814 \begin{minted}[linenos=false]{latex}
1815 I saw my friend \app{\lem{Peter}\rdg{John}} yesterday.
1816 or:
1817 I saw my friend
1818 \app{
1819 \lem{Peter}
1820 \rdg{John}
1821 }
1822 yesterday.
1823 \end{minted}
1824 % \iffalse
1825 %</example>
1826 % \fi
1827 % \cs{app} accepts one further optional argument:---\\
1828 % \DescribeOption{type} |type|$=$\meta{type}\phts\label{ref:app-type}
1829 % \hfill\tcboxverb{Default: default}\\
1830 % As will be described below in \vref{sec:multilayer-apparatus},
1831 % \pkg{ekdosis} initially sets one layer of notes\===the |default|
1832 % layer\===in the apparatus criticus. This layer is fit to receive
1833 % notes related to variant readings from witnesses and sources used by
1834 % the editor to establish the edition text. Additional layers can be
1835 % defined to receive other kinds of notes, such as references to texts
1836 % quoted or cited in the text of the edition (\emph{apparatus
1837 % fontium}), references to testimonia, or quotations of the edited
1838 % text by other authors (\emph{apparatus testium}), explanatory notes,
1839 % and so forth.\footnote{See below, \vref{ref:type-note}.} Once
1840 % additional layers have been defined and assigned to new
1841 % \enquote*{types}, such as \enquote*{testium} and the like, these
1842 % types can be used as values appended to the |type| \enquote*{named
1843 % option}. For more information about inserting notes in
1844 % multiple-layer apparatus, see \vref{sec:notes-in-multilayer-app}.
1845 %
1846 % \paragraph{Base text and variants} As can be seen in the example
1847 % above, there are two kinds of individual readings: the \emph{lemma},
1848 % which contains the base text accepted by the editor, and the
1849 % \emph{reading}, which contains deviant readings rejected by the
1850 % editor.
1851 %
1852 % \danger What follows refers to the notions of \enquote{witness},
1853 % \enquote{source} and \enquote{scholar} as defined above
1854 % \vpageref{sec:terminology}.
1855 %
1856 % \paragraph{Lemmata} \phts\label{ref:lemmata}\DescribeMacro{\lem}
1857 % \cs{lem}\oarg{options}\marg{lemma text}\\
1858 % As \meta{lemma text} is a word or a phrase judged by the editor to
1859 % be authentic or authoritative, \cs{lem} prints it by default both in
1860 % the edition text and as the first part of a new entry in the
1861 % apparatus criticus, preceded by the line number where it occurs or a
1862 % broad space when the entry refers to the same line as the preceding
1863 % entry. \phts\label{ref:lem-opts-b}The optional argument of \cs{lem}
1864 % accepts the following comma-separated list of \enquote{name$=$value}
1865 % arguments:---\\
1866 % \DescribeOption{wit} |wit|$=$\meta{csv list of
1867 % witnesses}\phts\label{ref:lem-wit}\\
1868 % While a single witness may be recorded as in |wit=A|,
1869 % comma-separated lists of multiple witnesses must obviously be
1870 % enclosed in curly braces, like so:
1871 % |wit={A,B,C}|. \phts\label{ref:mss-sep-families}It must be noted
1872 % that witnesses can be grouped by using spaces as separators, like
1873 % so: \verb*|wit={A,B,C, D,E,F}|. \danger In the apparatus criticus in
1874 % print, it is customary to remind the reader of the manuscript
1875 % groupings by spaces or commas. \pkg{ekdosis} prints spaces by
1876 % default, but can be instructed to print any other symbol
1877 % instead.\footnote{See below \vpageref{ref:familysep} for details.}
1878 % \danger Although any unique identifiers or labels used to
1879 % \enquote{declare} sources and scholars as described above
1880 % \vpagerefrange{ref:declare-source}{ref:declare-scholar} can also be
1881 % used as values of the |wit| optional argument, it is recommended to
1882 % use |sources| and |resp| to refer to either category
1883 % respectively as described below.\\
1884 % \DescribeOption{source} |source|$=$\meta{csv list of
1885 % sources}\phts\label{ref:lem-source}\newfeature[v1.1]\\
1886 % A \enquote{source} refers to any type of document consulted by the
1887 % editor to establish the edition text. Most commonly, corrections and
1888 % emendations from previous editions are cited in the apparatus
1889 % criticus.\footnote{For edition texts used as sources, see examples
1890 % below in \vref{sec:emendations-conjectures} and
1891 % \vref{sec:references-cited-works}.}\\
1892 % \DescribeOption{resp} |resp|$=$\meta{csv list of
1893 % scholars}\phts\label{ref:lem-resp}\newfeature[v1.1]\\
1894 % |resp| refers to scholars responsible for the emendations,
1895 % conjectures and corrections that are cited in the apparatus
1896 % criticus.\footnote{See detailed examples in
1897 % \vref{sec:emendations-conjectures}.}\\
1898 % \DescribeOption{alt} |alt|$=$\meta{alternate lemma}\\
1899 % While the mandatory argument of \cs{lem}, \meta{lemma text}, is
1900 % always used to print the edition text in the upper part of the page,
1901 % \meta{alternate lemma}, if specified, supersedes what is printed in
1902 % the related entry of the apparatus criticus. This mechanism is
1903 % useful in more than one respect. For instance, it can be used to
1904 % insert abbreviated lemmata in the apparatus criticus, or to
1905 % introduce an alternate way of writing entries with Latin technical
1906 % terms in the apparatus criticus as will be demonstrated below in the
1907 % example
1908 % provided by \vref{lst:pj2}.\\
1909 % \DescribeOption{sep} |sep|$=$\meta{separator}\\
1910 % |sep| allows to change the symbol used to separate the lemma text
1911 % from deviant readings, which is by default the closing square
1912 % bracket (|]|)\\
1913 % \DescribeOption{nosep} |nosep|$=$\verb+true|false+\\
1914 % This named argument does not need a value as it defaults to |true|
1915 % if used. |nosep| removes the separator mentioned above. Obviously,
1916 % |nosep| must be used when for some reason no \cs{rdg} command
1917 % follows a \cs{lem} command that has just been used, as shown below
1918 % in \vref{lst:emend-coni-corr}, l.~7. \danger If |nosep| be used so
1919 % as to insert an explanatory note after the lemma text with the
1920 % \cs{note} command described below \vpageref{ref:editorial-notes},
1921 % then the |sep| optional argument of \cs{note} can be used to put
1922 % back in the separator. This technique is demonstrated below in
1923 % \vref{lst:emend-coni-corr}, ll.~23--5.\\
1924 % \DescribeOption{nolem} |nolem|$=$\verb+true|false+\\
1925 % This named argument does not need a value as it defaults to |true|
1926 % if used. |nolem| completely removes the lemma text from the related
1927 % entry in the apparatus criticus.\\
1928 % \DescribeOption{type} |type|$=$\meta{value}\\
1929 % This named argument has no effect on the apparatus criticus of the
1930 % edition in print, but it is used in the \texttt{TEI xml} output to
1931 % classify the variation recorded in the entry according to some
1932 % convenient typology. Categories such as lexical, morphological,
1933 % orthographical and the like may apply. Obviously, |type=emendation|
1934 % should be restricted to lemma texts and |type=conjecture| to variant
1935 % readings recorded by means of \cs{rdg} described below.
1936 %
1937 % \needspace{2\baselineskip}
1938 % \noindent
1939 % \DescribeOption{num} (no-value
1940 % argument)\phts\label{ref:lem-num}\newfeature[v1.3]\\
1941 % |num| takes no value. If used, this argument instructs to print any
1942 % line number that \pkg{ekdosis} may have decided not to print in the
1943 % apparatus criticus before the lemma text.\\
1944 % \DescribeOption{nonum} (no-value
1945 % argument)\phts\label{ref:lem-nonum}\newfeature[v1.3]\\
1946 % Compared to |num|, |nonum| does the opposite. If used, any number
1947 % that \pkg{ekdosis} may have decided to print before the lemma text
1948 % is suppressed.
1949 %
1950 % \needspace{11\baselineskip}
1951 % Finally, four named arguments can be used to insert words at the
1952 % following specific places in the lemma text:\\
1953 % \noindent
1954 % \fparbox*{\centered{\textbf{1} \tikzmark{pre}\tred{pre} Peter
1955 % \tikzmark{post}\tred{post} \tikzmark{prewit}\tred{prewit}
1956 % \getsiglum{pjA}
1957 % \tikzmark{postwit}\tred{postwit}] John \getsiglum{pjB}}}\\
1958 % \DescribeOption{pre} |pre|$=$\meta{words}\pointtol{pre}\\
1959 % |pre| inserts \meta{words} \emph{before} the lemma text.\\
1960 % \DescribeOption{post} |post|$=$\meta{words}\pointto{post}\\
1961 % |post| inserts \meta{words} \emph{after} the lemma text.\\
1962 % \DescribeOption{prewit} |prewit|$=$\meta{words}\pointto{prewit}\\
1963 % |prewit| inserts \meta{words} \emph{before} the list of witnesses.\\
1964 % \DescribeOption{postwit} |postwit|$=$\meta{words}\pointtor{postwit}\\
1965 % |postwit| inserts \meta{words} \emph{after} the list of witnesses.
1966 % \phts\label{ref:lem-opts-e}
1967 %
1968 % \paragraph{Readings} \DescribeMacro{\rdg}
1969 % \cs{rdg}\oarg{options}\marg{variant reading}\\
1970 % As \meta{reading} is a word or a phrase judged by the editor to be
1971 % unsatisfactory or corrupted, \cs{rdg} prints it by default in the
1972 % last part of the corresponding entry in the apparatus criticus,
1973 % after the symbol that is used to separate words of the base text
1974 % (the lemma text) from words rejected by the editor. The optional
1975 % argument of \cs{rdg} accepts a comma-separated list of
1976 % \enquote{name$=$value} arguments that is almost identical to
1977 % \cs{app}. Therefore, emphasis will be placed here only on the
1978 % differences. The reader is invited to refer to the description
1979 % provided above \vpagerefrange{ref:lem-opts-b}{ref:lem-opts-e} for
1980 % more detailed information:---\\
1981 % \DescribeOption{wit} |wit|$=$\meta{csv list of
1982 % witnesses}\phts\label{ref:rdg-wit}\\
1983 % \DescribeOption{source} |source|$=$\meta{csv list of sources}\\
1984 % \DescribeOption{resp} |resp|$=$\meta{csv list of scholars}\\
1985 % \DescribeOption{alt} |alt|$=$\meta{alternate reading}\\
1986 % \DescribeOption{nordg} |nordg|$=$\verb+true|false+\\
1987 % This named argument does not need a value as it defaults to |true|
1988 % if used. |nordg| completely removes the variant reading from
1989 % the related entry in the apparatus criticus.\\
1990 % \DescribeOption{type} |type|$=$\meta{value}\\
1991 % Obviously, |type=conjecture| should be restricted to variant
1992 % readings and |type=emendation| to lemma texts recorded by means of
1993 % \cs{lem} described above.\\
1994 % \DescribeOption{pre} |pre|$=$\meta{words}\\
1995 % \DescribeOption{post} |post|$=$\meta{words}\\
1996 % \DescribeOption{prewit} |prewit|$=$\meta{words}\\
1997 % \DescribeOption{postwit} |postwit|$=$\meta{words}\\
1998 % \DescribeOption{subsep} |subsep|$=$\meta{subseparator}\\
1999 % \newfeature[v1.4] |subsep| inserts a subseparator to be printed
2000 % \emph{before} the current entry as described below
2001 % \vpageref{ref:setsubseparator}. This option is supposed to be used
2002 % when no subseparator is defined, or when one is defined but for some
2003 % reason a different subseparator is needed for the current
2004 % entry.\\
2005 % \DescribeOption{nosubsep} This argument-less option removes the
2006 % subseparator from the current entry, provided one has been set by
2007 % means of \cs{SetSubseparator}, \cs{SetApparatus} or
2008 % \cs{DeclareApparatus}.\footnote{See
2009 % \vpagerefrange{ref:setsubseparator}{ref:apparatus-settings-e} and
2010 % \vref{sec:declaring-layers} for details.}
2011 %
2012 % \paragraph{Notes}
2013 % \DescribeMacro{\note}\phts\label{ref:notes-b}\DescribeMacro{\note*}
2014 % \cs{note}\oarg{options}\marg{text} or
2015 % \cs{note*}\oarg{options}\marg{text}\phts\label{ref:editorial-notes}\\
2016 % It may happen that editorial notes are needed to record short
2017 % comments of general nature \emph{between} lemmata and
2018 % readings. \cs{note} inserts inline comments while \cs{note*} places
2019 % comments below the entire apparatus block. Furthermore, if
2020 % \pkg{ekdosis} be loaded with the |parnotes| option as described
2021 % above \vpageref{ref:parnotes-opt}, \cs{note*} will use the
2022 % \pkg{parnotes} package to lay out the notes as an additional
2023 % paragraph below the apparatus criticus. The optional argument of
2024 % \cs{note}/\cs{note*} accepts the following comma-separated list of
2025 % \enquote{name$=$value}
2026 % arguments:---\\
2027 % \DescribeOption{pre} |pre|$=$\meta{words}\\
2028 % |pre| inserts \meta{words} immediately before the note.\\
2029 % \DescribeOption{post} |post|$=$\meta{words}\\
2030 % |post| inserts \meta{words} immediately after the note.\\
2031 % \DescribeOption{sep} This argument-less option is equivalent to
2032 % |post=\ekdsep|.\seeekdsep\\
2033 % \DescribeOption{subsep} This argument-less option is equivalent to
2034 % |pre=\ekdsubsep|.\seeekdsep\\
2035 %
2036 % \danger Under no circumstances is it permitted to insert this
2037 % command \cs{note} or \cs{note*} inside the argument of \cs{lem} or
2038 % \cs{rdg}. \cs{note}/\cs{note*} must go \emph{between} these
2039 % commands. As a general rule, within \cs{app}|{}| elements, notes are
2040 % inserted immediately \emph{after} the lemma or the variant reading
2041 % they are related to. However, as will be described below in
2042 % \vref{ref:type-note}, the command \cs{note}\---with no star
2043 % appended\---that is used to insert explanatory notes or references
2044 % to sources or testimonia is permitted within the mandatory argument
2045 % of \cs{lem}|{}|, although it is subject to a very strict syntax.
2046 %
2047 % \Vref{lst:pj2} provides an illustration of some of the possibilities
2048 % afforded by the commands just described:---
2049 %
2050 % \captof{The \enquote{Peter/John} full example}[\label{lst:pj2}]
2051 % \iffalse
2052 %<*example>
2053 % \fi
2054 \begin{minted}{latex}
2055 \begin{ekdosis}
2056 I
2057 \app{
2058 \lem[wit=A]{saw}
2059 \rdg[wit=B]{met}}
2060 my friend
2061 \app{
2062 \lem{Peter}
2063 \rdg{John}
2064 }
2065 at the station yesterday. We were both in a
2066 \app{
2067 \lem[wit=A]{great}
2068 \rdg[wit=B]{good}}
2069 mood.
2070 \app{
2071 \lem[wit=A, alt={How nice... said}]{\enquote{How nice to find
2072 you here!} he said.}
2073 \note*{There are no quotation marks in the mss.}
2074 \rdg[wit=B, alt=\emph{om.}]{}}
2075 I chuckled to myself, recalling the last time we
2076 \app{
2077 \lem[wit=A,nolem]{met}
2078 \rdg[wit=B, alt={\emph{post} met \emph{add.} there}]{met
2079 there}
2080 \note*{Ms. \getsiglum{B} provides other additions of this kind.}}.
2081 \end{ekdosis}
2082 \end{minted}
2083 % \iffalse
2084 %</example>
2085 % \fi
2086 %
2087 % \needspace{7\baselineskip}
2088 % \resetlinenumber
2089 % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
2090 % \begin{specimen}
2091 % I \app{\lem[wit=pjA]{saw}\rdg[wit=pjB]{met}} my friend
2092 % \app{
2093 % \lem{Peter}
2094 % \rdg{John}
2095 % }
2096 % at the station yesterday. We were both in a
2097 % \app{
2098 % \lem[wit=pjA]{great}
2099 % \rdg[wit=pjB]{good}}
2100 % mood.
2101 % \app{
2102 % \lem[wit=pjA, alt={\textooquote How nice... said}]{\enquote{How
2103 % nice to find you here!} he said.}
2104 % \note*{There are no quotation marks in the mss.}
2105 % \rdg[wit=pjB, alt=\emph{om.}]{}}
2106 % I chuckled to myself, recalling the last time we
2107 % \app{
2108 % \lem[wit=pjA,nolem]{met}
2109 % \rdg[wit=pjB, alt={\emph{post} met \emph{add.} there}]{met
2110 % there}
2111 % \note*{Ms. \getsiglum{pjB} provides other additions of this kind.}}.
2112 % \end{specimen}
2113 % \end{alignment}
2114 %
2115 % \begin{remarks}
2116 % \item Close examination of lines~17--8 from \vref{lst:pj2} shows how
2117 % |alt| has been used to insert an abridged lemma text in the
2118 % apparatus criticus in print while keeping safe what is to be found
2119 % in the \texttt{TEI xml} output.
2120 % \item The same technique has been used at line~24 to insert
2121 % alternate words, including Latin technical terms, in place of the
2122 % variant reading. Hence the use of |nolem| at line~23 to remove the
2123 % lemma text from the apparatus criticus in print.
2124 % \item \cs{note*} has been used to insert short annotations in two
2125 % places (ll.~19 and 26).
2126 % \item For an example of the use of |nordg|, see below
2127 % \vref{lst:caesar-bg}, l.~11.
2128 % \end{remarks}
2129 %
2130 % The corresponding \texttt{TEI xml} output produced by \pkg{ekdosis}
2131 % from the \LaTeX{} source file follows:---
2132 %
2133 % \captof{The \enquote{Peter/John} full example: \texttt{TEI xml}
2134 % output}[\label{lst:pj2-tei}]
2135 % \iffalse
2136 %<*example>
2137 % \fi
2138 \begin{minted}[linenos=false]{xml}
2139 <p>I
2140 <app>
2141 <lem wit="#A">saw</lem>
2142 <rdg wit="#B">met</rdg>
2143 </app>my friend
2144 <app>
2145 <lem>Peter</lem>
2146 <rdg>John</rdg>
2147 </app>at the station yesterday. We were both in a
2148 <app>
2149 <lem wit="#A">great</lem>
2150 <rdg wit="#B">good</rdg>
2151 </app>mood.
2152 <app>
2153 <lem wit="#A">
2154 <quote>How nice to find you here!</quote> he said.</lem>
2155 <note>There are no quotation marks in the mss.</note>
2156 <rdg wit="#B" />
2157 </app>I chuckled to myself, recalling the last time we
2158 <app>
2159 <lem wit="#A">met</lem>
2160 <rdg wit="#B">met there</rdg>
2161 <note>Ms.
2162 <ref target="#B">B</ref>provides other additions of
2163 this kind.</note>
2164 </app>.</p>
2165 \end{minted}
2166 % \iffalse
2167 %</example>
2168 % \fi
2169 % \phts\label{ref:notes-e}
2170 %
2171 % \subsection{Indicating Subvariation in Apparatus Entries}
2172 % \label{sec:indic-subv-appar}
2173 % It must be noted that grouping readings so as to keep emphasis on
2174 % subvariation, regardless of its cause, is entirely optional.
2175 % Furthermore, the applicability of this technique is limited to the
2176 % \texttt{TEI xml} output as it helps the machines to understand a
2177 % grouping otherwise immediately accessible to human mind from the
2178 % information that is available in well-written
2179 % apparatus. \pkg{ekdosis} provides two ways of expressing
2180 % subvariation.
2181 %
2182 % \subsubsection{Implicit Grouping}
2183 % \label{sec:implicit-grouping}
2184 % Because apparatus entries may nest recursively, the \cs{app} command
2185 % can be used to group similar readings.
2186 %
2187 % \danger However, for nesting to work, the |alt| optional argument
2188 % must be used in every \cs{lem} and \cs{rdg} command involved in the
2189 % nesting. This rule applies to both parent and child commands, as
2190 % demonstrated in the following example:---
2191 %
2192 % \iffalse
2193 %<*example>
2194 % \fi
2195 \begin{minted}[linenos=false]{latex}
2196 As I was walking home through Times Square, I saw my friend
2197 \app{
2198 \lem[wit={A,B}, alt={Peter\---Street}]{Peter at the
2199 \app{
2200 \lem[wit=A, alt=station]{station}
2201 \rdg[wit=B, alt=bookstore]{bookstore}
2202 }
2203 on 42nd Street}
2204 \rdg[wit=C, alt={John on Broadway}]{John on Broadway}
2205 }.
2206 \end{minted}
2207 % \iffalse
2208 %</example>
2209 % \fi
2210 %
2211 % PDF output:---
2212 % \medskip
2213 %
2214 % \needspace{7\baselineskip}
2215 % \resetlinenumber
2216 % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
2217 % \begin{specimen}
2218 % As I was walking home through Times Square, I saw my friend
2219 % \app{
2220 % \lem[wit={pjA,pjB}, alt={Peter\---Street}]{Peter at the
2221 % \app{
2222 % \lem[wit=pjA, alt=station]{station}
2223 % \rdg[wit=pjB, alt=bookstore]{bookstore}}
2224 % on 42nd Street}
2225 % \rdg[wit=pjC, alt={John on Broadway}]{John on Broadway}}.
2226 % \end{specimen}
2227 % \end{alignment}
2228 %
2229 % \begin{remarks}
2230 % \item[\textsc{Rem.}] Two \cs{app} commands naturally insert two
2231 % entries in the apparatus criticus. As the subvariation comes
2232 % first, what ms.\ C reads is only mentioned in the subsequent
2233 % entry.
2234 % \end{remarks}
2235 %
2236 % \texttt{TEI xml} output:---
2237 %
2238 % \iffalse
2239 %<*example>
2240 % \fi
2241 \begin{minted}[linenos=false]{xml}
2242 <p>As I was walking home through Times Square, I saw my
2243 friend
2244 <app>
2245 <lem wit="#A #B">Peter at the
2246 <app>
2247 <lem wit="#A">station</lem>
2248 <rdg wit="#B">bookstore</rdg>
2249 </app>on 42nd Street</lem>
2250 <rdg wit="#C">John on Broadway</rdg>
2251 </app>.</p>
2252 \end{minted}
2253 % \iffalse
2254 %</example>
2255 % \fi
2256 %
2257 % \danger It must be noted that from a technical standpoint, albeit
2258 % the nested lemmas are printed \emph{before} their parents in the
2259 % apparatus criticus, they are seen by \pkg{ekdosis} \emph{after} the
2260 % latter as the source file is compiled. As a result, notably when the
2261 % whole nested group of lemmas falls on the same line without being
2262 % preceded by an apparatus entry on this line, it may be needed to
2263 % suppress redundant numbers that \pkg{ekdosis} may have decided to
2264 % print in the appartus criticus. Conversely, it may be needed to
2265 % print numbers that \pkg{ekdosis} may have decided not to print. To
2266 % both ends, the |num| and |nonum| optional arguments of the \cs{lem}
2267 % command can be used as described above
2268 % \vpagerefrange{ref:lem-num}{ref:lem-nonum}.
2269 %
2270 % \subsubsection{Explicit Grouping}
2271 % \label{sec:explicit-grouping}
2272 % \DescribeMacro{\rdgGrp} \cs{rdgGrp}\oarg{options}\marg{lemma text
2273 % \textbar\ readings}\newfeature[v1.1]\\
2274 % Explicit grouping of readings can be achieved by means of the
2275 % \cs{rdgGrp} command. It takes as mandatory argument the commands
2276 % used for inserting lemma texts, readings and notes that are
2277 % described \vpagerefrange{ref:lemmata}{ref:notes-e}, viz.\ \cs{lem},
2278 % \cs{rdg} and \cs{note}. \cs{rdgGrp} accepts one further optional
2279 % argument:---\\
2280 % \DescribeOption{type} |type|$=$\meta{value}\\
2281 % This named argument is used in the \texttt{TEI xml} output to
2282 % define an attribute common to all elements representing the
2283 % variation.
2284 %
2285 % Here follows how the technique of explicit grouping would apply to
2286 % the same passage as above:---
2287 %
2288 % \iffalse
2289 %<*example>
2290 % \fi
2291 \begin{minted}[linenos=false]{latex}
2292 As I was walking home through Times Square, I saw my friend
2293 \app{
2294 \rdgGrp[type=subvariation]{
2295 \lem[wit=A, alt={Peter\---Street}]{Peter at the station
2296 on 42nd Street}
2297 \rdg[wit=B, alt={bookstore \emph{pro} station}]{Peter at the
2298 bookstore on 42nd Street}
2299 }
2300 \rdg[wit=C]{John on Broadway}
2301 }.
2302 \end{minted}
2303 % \iffalse
2304 %</example>
2305 % \fi
2306 %
2307 % PDF output:---
2308 % \medskip
2309 %
2310 % \needspace{7\baselineskip}
2311 % \resetlinenumber
2312 % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
2313 % \begin{specimen}
2314 % As I was walking home through Times Square, I saw my friend
2315 % \app{
2316 % \rdgGrp[type=subvariation]{
2317 % \lem[wit=pjA, alt={Peter\---Street}]{Peter at the station
2318 % on 42nd Street}
2319 % \rdg[wit=pjB, alt={bookstore \emph{pro} station}]{Peter at the
2320 % bookstore on 42nd Street}
2321 % }
2322 % \rdg[wit=pjC]{John on Broadway}
2323 % }.
2324 % \end{specimen}
2325 % \end{alignment}
2326 %
2327 % \begin{remarks}
2328 % \item[\textsc{Rem.}] In this example, the subvariation is emphasized
2329 % with a Latin technical term and may be expressed in one single
2330 % entry in a more economical manner.
2331 % \end{remarks}
2332 %
2333 % \texttt{TEI xml} output:---
2334 %
2335 % \iffalse
2336 %<*example>
2337 % \fi
2338 \begin{minted}[linenos=false]{xml}
2339 <p>As I was walking home through Times Square, I saw my
2340 friend
2341 <app>
2342 <rdgGrp type="subvariation">
2343 <lem wit="#A">Peter at the station on 42nd
2344 Street</lem>
2345 <rdg wit="#B">Peter at the bookstore on 42nd
2346 Street</rdg>
2347 </rdgGrp>
2348 <rdg wit="#C">John on Broadway</rdg>
2349 </app>.</p>
2350 \end{minted}
2351 % \iffalse
2352 %</example>
2353 % \fi
2354 %
2355 % \section{Emendations and Conjectures}
2356 % \label{sec:emendations-conjectures}
2357 % From a technical standpoint, \enquote{conjectures} are readings that
2358 % are not supported by manuscript evidence, but are instead proposed
2359 % by scholars to be taken into consideration for establishing the
2360 % edition text. A conjecture is called an \enquote{emendation} when it
2361 % is adopted in place of what is provided by or missing from the text
2362 % provided by the manuscripts. Emendations and conjectures are
2363 % therefore readings and as such expected to be found within |<lem>|
2364 % or |<rdg>| elements. However, as both come from editions or
2365 % scholars, not from manuscripts, they are naturally associated with
2366 % |source| or |resp| attributes as described above
2367 % \vpagerefrange{ref:lem-source}{ref:lem-resp},\footnote{See also
2368 % \vpagerefrange{ref:declare-source}{ref:declare-scholar}.} and can be
2369 % distinguished from one another by the |type| attribute, eg.\ either
2370 % |emendation| or |conjecture|.
2371 %
2372 % As an example, the representation of witnesses, editors and
2373 % shorthands of Hippocrates' \emph{Epidemics}, Book~2 could be
2374 % summarized as follows:---
2375 %
2376 % \iffalse
2377 %<*example>
2378 % \fi
2379 \begin{minted}{latex}
2380 % Witnesses:
2381 \DeclareWitness{V}{V}{\emph{Vaticanus Gr.} 276}
2382 \DeclareWitness{I}{I}{\emph{Parisinus Gr.} 2140}
2383 \DeclareHand{Iac}{I}{I\textsuperscript{ac}}[Lectio ante correctionem]
2384 \DeclareHand{Ipc}{I}{I\textsuperscript{pc}}[Lectio post correctionem]
2385 \DeclareWitness{R}{R}{\emph{Vaticanus Gr.} 277}
2386 \DeclareWitness{H}{H}{\emph{Parisinus Gr.} 2142}
2387 % Sources (the first arguments below must refer to biblatex labels and
2388 % an xml bibliographical database must be supplied):
2389 \DeclareSource{Lit}{Littré}
2390 \DeclareSource{Erm}{Ermerins}
2391 \DeclareSource{Sm}{Smith}
2392 % Persons:
2393 \DeclareScholar{ego}{ego}[
2394 forename=Robert,
2395 surname=Alessi]
2396 % Useful shorthands:
2397 \DeclareShorthand{codd}{codd.}{V,I,R,H}
2398 \DeclareShorthand{edd}{edd.}{Lit,Erm,Sm}
2399 \DeclareShorthand{egoscr}{\emph{scripsi}}{ego}
2400 \end{minted}
2401 % \iffalse
2402 %</example>
2403 % \fi
2404 %
2405 % As can be seen from lines~18--20, three useful shorthands have been
2406 % defined: |codd| prints \enquote{codd.} for Latin pl.\ \emph{codices}
2407 % viz.\ \enquote{all manuscripts} and refers to the three \texttt{xml}
2408 % identifiers |V|, |I|, |R| and |H| declared at ll.~2--3 and 6--7;
2409 % |edd| prints \enquote{edd.} for Latin pl.\ \emph{editores} viz.\
2410 % \enquote{all editors} and refers to the three \texttt{xml}
2411 % identifiers |Lit|, |Erm| and |Sm| declared at
2412 % ll.~10--12;\footnote{For detailed information on how to use
2413 % \cs{DeclareSource} and insert references to cited works, the reader
2414 % is invited to refer to \vref{sec:references-cited-works}.} finally,
2415 % |egoscr| (l.~20) is used to print the technical Latin term
2416 % \enquote{\emph{scripsi}}, \enquote{I wrote}, to denote a personal
2417 % conjecture. Then, the |.tex| source file can be structured as
2418 % follows:---
2419 %
2420 % \iffalse
2421 %<*example>
2422 % \fi
2423 \begin{minted}{latex}
2424 \begin{ekdosis}
2425 καὶ ἐγίνετο μᾶλλον \app{
2426 \lem[wit={V, Ipc,R,H}]{νότῳ}
2427 \rdg[wit=Iac]{νότου}
2428 \rdg[source=Erm, type=conjecture]{ἐν νώτῳ}}· [...] % conjecture
2429
2430 εἰ
2431 \app{
2432 \lem[resp=egoscr, type=emendation]{μὲν} % emendation
2433 \rdg[wit=codd, source=edd]{μὴ}
2434 } εἴη διὰ ταῦτα [...]
2435 \end{ekdosis}
2436 \end{minted}
2437 % \iffalse
2438 %</example>
2439 % \fi
2440 %
2441 % \begin{remarks}
2442 % \item Line~5 introduces a \emph{conjecture} which has been annotated
2443 % with |type=conjecture| to facilitate its identification. Other
2444 % optional arguments could have been used, such as
2445 % |prewit=|\texttt{coni.} or |prewit=|\texttt{falso coni.}, to print
2446 % explanatory words in the apparatus criticus before the abridged
2447 % name of the scholar.
2448 % \item \phts\label{it:egomute}Conversely, line~9 introduces an
2449 % \emph{emendation} for which the shorthand |egoscr| has been used
2450 % to print the exact term \emph{scripsi} in the apparatus criticus
2451 % while keeping |ego| as an |xml:id| for the \texttt{TEI xml} output
2452 % file. Other strategies could have been used. For example, one
2453 % could have defined a specific shorthand to print nothing in place
2454 % of |ego| and leave the insertion of technical terms to the |post|
2455 % optional argument of \cs{lem}, like so:---
2456 % \iffalse
2457 %<*example>
2458 % \fi
2459 \begin{minted}[linenos=false]{latex}
2460 % Preamble:
2461 % (\unskip is for removing the space left by the empty 2nd argument
2462 % below.)
2463 \DeclareShorthand{egomute}{\unskip}{ego}
2464
2465 % Document:
2466 \app{
2467 \lem[resp=egomute, post=\emph{scripsi}, type=emendation]{μὲν}
2468 \rdg[wit=codd, source=edd]{μὴ}
2469 } εἴη διὰ ταῦτα [...]
2470 \end{minted}
2471 % \iffalse
2472 %</example>
2473 % \fi
2474 % \end{remarks}
2475 %
2476 % PDF output:---
2477 % \medskip
2478 %
2479 % \needspace{7\baselineskip}
2480 % \resetlinenumber
2481 % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
2482 % \begin{specimen}
2483 % \begin{ancientgreek}
2484 % καὶ ἐγίνετο μᾶλλον \app{
2485 % \lem[wit={hV, hIpc,hR,hH}]{νότῳ}
2486 % \rdg[wit=hIac]{νότου}
2487 % \rdg[source=Erm, type=conjecture]{ἐν νώτῳ}}· [...]
2488 %
2489 % εἰ \app{
2490 % \lem[resp=hegoscr, type=emendation]{μὲν}
2491 % \rdg[wit=hcodd, source=hedd]{μὴ}
2492 % } εἴη διὰ ταῦτα [...]
2493 % \end{ancientgreek}
2494 % \end{specimen}
2495 % \end{alignment}
2496 %
2497 % \texttt{TEI xml} output:---
2498 % \enlargethispage{\baselineskip}
2499 % \iffalse
2500 %<*example>
2501 % \fi
2502 \begin{minted}[linenos=false]{xml}
2503 <p xml:lang="grc">καὶ ἐγίνετο μᾶλλον
2504 <app>
2505 <lem wit="#V #Ipc #R #H">νότῳ</lem>
2506 <rdg wit="#Iac">νότου</rdg>
2507 <rdg source="#Erm" type="conjecture">ἐν νώτῳ</rdg>
2508 </app>· [...]</p>
2509 <p>εἰ
2510 <app>
2511 <lem resp="#ego" type="emendation">μὲν</lem>
2512 <rdg wit="#V #I #R #H" source="#Lit #Erm #Sm">
2513 μὴ</rdg>
2514 </app>εἴη διὰ ταῦτα [...]</p>
2515 \end{minted}
2516 % \iffalse
2517 %</example>
2518 % \fi
2519 %
2520 % \subsection{Editorial Addition and Deletion}
2521 % \label{sec:editorial-add-del}
2522 % \pkg{ekdosis} provides a set of commands to indicate that text has
2523 % been supplied or removed by conjecture. As regards critical
2524 % symbols conventionally used for representing emendations, lacunae,
2525 % omissions, gaps, editorial deletions or additions and the like,
2526 % \pkg{ekdosis} follows the standards as described by
2527 % \textcite[80--82]{West1973}:---
2528 % \begin{description}[font=\ttfamily]
2529 % \item[<>] text added by conjecture or from a parallel source.
2530 % \item[***] lacuna in the whole textual tradition.
2531 % \item[<***>] conjectured lacuna.
2532 % \item[\{\}] editorial deletion.
2533 % \item[\dag\dag] text judged by the editor to be corrupt. Note that if
2534 % only one word be suspect, only one crux is needed.
2535 % \end{description}
2536 %
2537 % \DescribeMacro{\SetCritSymbols}\newfeature[v1.1]
2538 % \cs{SetCritSymbols}\marg{csv list of options} can be used to change
2539 % the critical symbols described above. This command accepts the
2540 % following list of |key-value|
2541 % optional arguments:---\\
2542 % \DescribeOption{suppbegin}|suppbegin|$=$\meta{symbol}
2543 % \hfill\tcboxverb{Default: <}\\
2544 % The opening symbol used to mark the text that is supplied.\\
2545 % \DescribeOption{suppend}|suppend|$=$\meta{symbol}
2546 % \hfill\tcboxverb{Default: >}\\
2547 % The closing symbol used to mark the text that is supplied.\\
2548 % \DescribeOption{delbegin}|delbegin|$=$\meta{symbol}
2549 % \hfill\tcboxverb|Default: {|\\
2550 % The opening symbol used to mark the text that is deleted.\\
2551 % \DescribeOption{delend}|delend|$=$\meta{symbol}
2552 % \hfill\tcboxverb|Default: }|\\
2553 % The closing symbol used to mark the text that is deleted.\\
2554 % \DescribeOption{sicbegin}|sicbegin|$=$\meta{symbol}
2555 % \hfill\tcboxverb{Default: †}\\
2556 % The opening symbol used to mark the text that is deemed to be
2557 % suspect.\\
2558 % \DescribeOption{sicend}|sicend|$=$\meta{symbol}
2559 % \hfill\tcboxverb{Default: †}\\
2560 % The closing symbol used to mark the text that is deemed to be
2561 % suspect.\\
2562 % \DescribeOption{gapmark}|gapmark|$=$\meta{symbols}
2563 % \hfill\tcboxverb{Default: ***}\\
2564 % The symbols used to mark lacunae.\\
2565 % \DescribeOption{keepinapp} |keepinapp|$=$\verb+true|false+
2566 % \hfill\tcboxverb{Default: false}\\
2567 % \newfeature[v1.4] This named argument does not need a value as it
2568 % defaults to |true| if used. By default, the critical symbols used by
2569 % \cs{supplied}, \cs{surplus} and \cs{sic} described below
2570 % \vpagerefrange{ref:corr-cmds-b}{ref:corr-cmds-e} are printed in the
2571 % edition text but removed from the apparatus. |keepinapp| instructs
2572 % \pkg{ekdosis} to print these symbols in both places.
2573 %
2574 % As an example, what follows sets |[]| for deletions and |...| for
2575 % lacunae:---
2576 %
2577 % \iffalse
2578 %<*example>
2579 % \fi
2580 \begin{minted}[linenos=false]{latex}
2581 \SetCritSymbols{
2582 delbegin = [,
2583 delend = ],
2584 gapmark = \dots
2585 }
2586 \end{minted}
2587 % \iffalse
2588 %</example>
2589 % \fi
2590 %
2591 % \danger If modified, brackets can be adapted to languages that are
2592 % written from right to left. To that effect, \pkg{ekdosis} provides a
2593 % boolean expression |al@rlmode| which is evaluated as |true| if the
2594 % writing direction be set from right to left and as |false|
2595 % otherwise. As the \pkg{etoolbox} package is loaded by \pkg{ekdosis},
2596 % \cs{ifboolean}|{al@rlmode}|\marg{rtl symbol}\marg{ltr symbol} can be
2597 % used to perform the test.
2598 %
2599 % \paragraph{Editorial Addition}
2600 % \phts\label{ref:corr-cmds-b}
2601 % \DescribeMacro{\supplied}\newfeature[v1.1]\cs{supplied}\marg{text}
2602 % is used to mark \meta{text} that is by definition missing from the
2603 % tradition as supplied by the editor or some other scholar. This
2604 % command is normally expected in \cs{lem}|{}| or \cs{rdg}|{}|.
2605 %
2606 % \paragraph{Editorial Deletion}
2607 % \DescribeMacro{\surplus}\newfeature[v1.1] \cs{surplus}\marg{text}
2608 % is used to mark \meta{text} that is deemed to be inauthentic, but
2609 % nevertheless retained between braces in the edition text as it is
2610 % transmitted by all witnesses. This command is normally expected in
2611 % \cs{lem}|{}| or \cs{rdg}|{}|.
2612 %
2613 % \paragraph{Crux}
2614 % \DescribeMacro{\sic}\newfeature[v1.1] \cs{sic}\marg{text} takes as
2615 % mandatory argument the text deemed by the editor to be readable but
2616 % not understandable. \cs{sic} inserts \meta{text} between cruces
2617 % while \cs{sic*} prints only one crux before \meta{text}.
2618 % \phts\label{ref:corr-cmds-e}
2619 %
2620 % \paragraph{Lacuna}
2621 % \DescribeMacro{\gap}\newfeature[v1.1] \cs{gap}\marg{csv list of
2622 % options} indicates that some amount of text has fallen away from the
2623 % entire tradition. It takes as mandatory argument a comma-separated
2624 % list of options that can be used to further specify the reason for
2625 % omission, the unit of measurement, the quantity or the extent, as
2626 % follows:---\\
2627 % \DescribeOption{reason}|reason|$=$\meta{reason}\\
2628 % |reason| gives the reason for omission.\\
2629 % \DescribeOption{unit} |unit|$=$\meta{unit}\\
2630 % |unit| provides some regularized measurement, such as |character|,
2631 % |word|, |line| and the like.
2632 % \DescribeOption{quantity} |quantity|$=$\meta{n}\\
2633 % |quantity| specifies the number of the given unit that comprise the
2634 % measurement.\\
2635 % \DescribeOption{extent} |extent|$=$\meta{description}\\
2636 % |extent| describes the size, including quantity and unit in a single
2637 % string of words.
2638 %
2639 % \paragraph{Conjectured Lacuna}
2640 % Assumably, the conjectured lacuna should be enclosed by
2641 % \cs{supplied} and as such contained by \cs{lem} with
2642 % |type=emendation| to indicate that the lacuna has been accepted by
2643 % the editor.
2644 %
2645 % Examples follow:\footnote{On the use of \texttt{egomute} (l.~2), see
2646 % above \vref{it:egomute}.}---
2647 %
2648 % \captof{Emendations, conjectures and
2649 % corrections}[\label{lst:emend-coni-corr}]
2650 % \iffalse
2651 %<*example>
2652 % \fi
2653 \begin{minted}{latex}
2654 % Preamble:
2655 \DeclareShorthand{egomute}{\unskip}{ego}
2656
2657 % Document:
2658 \begin{ekdosis}
2659 σχεδὸν \app{
2660 \lem[resp=egomute, nosep, post={post σχεδὸν quattuor uerba
2661 excidisse uid.}, type=emendation]{\supplied{\gap{reason=lost,
2662 unit=word, quantity=4}}}
2663 } οὗτοι
2664
2665 subsidiis magnis \sic*{epicuri} constabilitas
2666
2667 declinare quis est qui \sic{possit cernere sese}.
2668
2669 \app{
2670 \lem[resp=egomute, type=emendation, nosep, post={ante
2671 ὑπογίν.}]{\surplus{καὶ}}
2672 \note{deleui e Gal.P}
2673 } ὑπογίνονται
2674
2675 Πάντων δὲ \app{
2676 \lem[resp=egomute, type=emendation, nosep]{\supplied{τῶν πυρετῶν}}
2677 \note[sep]{addidi (\arb{^gamI`a 'l-.hummayAti}
2678 \getsiglum{Gal})}
2679 \rdg[nordg, source=Gal]{\arb{al-.hummayAti}}
2680 \rdg[wit=codd, source=edd, alt=om.]{}
2681 },
2682 \end{ekdosis}
2683 \end{minted}
2684 % \iffalse
2685 %</example>
2686 % \fi
2687 %
2688 % \needspace{11\baselineskip}
2689 % PDF output:---
2690 % \medskip
2691 %
2692 % \resetlinenumber
2693 % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
2694 % \begin{specimen}
2695 % σχεδὸν \app{
2696 % \lem[resp=egomute, nosep, post={post σχεδὸν quattuor uerba
2697 % excidisse uid.}, type=emendation]{\supplied{\gap{reason=lost,
2698 % unit=word, quantity=4}}}
2699 % } οὗτοι
2700 %
2701 % subsidiis magnis \sic*{epicuri} constabilitas
2702 %
2703 % declinare quis est qui \sic{possit cernere sese}.
2704 %
2705 % \app{
2706 % \lem[resp=egomute, type=emendation, nosep, post={ante
2707 % ὑπογίν.}]{\surplus{καὶ}}
2708 % \note{deleui e Gal.P}
2709 % } ὑπογίνονται
2710 %
2711 %
2712 % Πάντων δὲ \app{
2713 % \lem[resp=egomute, type=emendation, nosep]{\supplied{τῶν πυρετῶν}}
2714 % \note[sep]{addidi (\arb{^gamI`a 'l-.hummayAti}
2715 % \getsiglum{Gal})}
2716 % \rdg[nordg, source=Gal]{\arb{al-.hummayAti}}
2717 % \rdg[wit=hcodd, source=hedd, alt=om.]{}
2718 % },
2719 % \end{specimen}
2720 % \end{alignment}
2721 %
2722 % \texttt{TEI xml} output:---
2723 %
2724 % \iffalse
2725 %<*example>
2726 % \fi
2727 \begin{minted}[linenos=false]{xml}
2728 <p>σχεδὸν
2729 <app>
2730 <lem resp="#ego" type="emendation">
2731 <supplied>
2732 <gap reason="lost" unit="word" quantity="4" />
2733 </supplied>
2734 </lem>
2735 </app>οὗτοι</p>
2736 <p>subsidiis magnis
2737 <sic>epicuri</sic> constabilitas</p>
2738 <p>declinare quis est qui
2739 <sic>possit cernere sese</sic>.</p>
2740 <p>
2741 <app>
2742 <lem resp="#ego" type="emendation">
2743 <surplus>καὶ</surplus>
2744 </lem>
2745 <note>deleui e Gal.P</note>
2746 </app>ὑπογίνονται</p>
2747 <p>Πάντων δὲ
2748 <app>
2749 <lem resp="#ego" type="emendation">
2750 <supplied>τῶν πυρετῶν</supplied>
2751 </lem>
2752 <note>addidi (
2753 <foreign xml:lang="ar-Latn" type="transliterated"
2754 subtype="arabtex">^gamI`a 'l-.hummayAti</foreign>
2755 <ref target="#Gal">Gal.</ref>)</note>
2756 <rdg source="#Gal">
2757 <foreign xml:lang="ar-Latn" type="transliterated"
2758 subtype="arabtex">al-.hummayAti</foreign>
2759 </rdg>
2760 <rdg wit="#V #I #R #H" source="#Lit #Erm #Sm" />
2761 </app>,</p>
2762 \end{minted}
2763 % \iffalse
2764 %</example>
2765 % \fi
2766 %
2767 % \section{Alignment of Parallel Texts}
2768 % \label{sec:alignment-basic}
2769 % As already said above,\footnote{See point
2770 % \vref{it:multicol-feature}.} \pkg{ekdosis} can arrange sundry texts
2771 % in parallel columns\---synchronized or not\---either on the same
2772 % page or on facing pages. Depending on what is needed, any text can
2773 % be equipped with an apparatus criticus. The most common example is
2774 % that of an edition of a classical text with an apparatus criticus
2775 % accompanied by a translation into a modern language on the facing
2776 % page. One can also imagine an edition of two classical texts or two
2777 % different recensions of the same text, each of which provides
2778 % variants recorded in separate apparatus criticus, laid out on the
2779 % left-hand pages, with one or more translations on the corresponding
2780 % right-hand pages, and so forth.
2781 %
2782 % \paragraph{The \env{alignment} Environment}
2783 % \DescribeEnv{alignment} \cs{begin}|{alignment}|\oarg{options}\dots
2784 % \cs{end}|{alignment}|\phts\label{ref:alignment-syntax}\\
2785 % This environment can be used as it is provided to typeset a standard
2786 % critical edition, namely an edition text, equipped with an apparatus
2787 % criticus and laid out on the left-hand pages, accompanied by a
2788 % translation into a modern language on the facing pages.
2789 %
2790 % \DescribeEnv{edition}\DescribeEnv{translation} Within
2791 % \env{alignment}, two environments are available by default:
2792 % \cs{begin}|{edition}|\allowbreak\dots
2793 % \cs{end}|{ed|\allowbreak|ition}| and \cs{begin}|{translation}|\dots
2794 % \cs{end}|{translation}|. Obviously, the former is used to typeset
2795 % the edition text with an apparatus criticus on the left, while the
2796 % latter is used to typeset the translation on the right, like so:---
2797 % \iffalse
2798 %<*example>
2799 % \fi
2800 \begin{minted}[linenos=false]{latex}
2801 \begin{alignment}
2802 \begin{edition}
2803 First § of the edition text.
2804 \end{edition}
2805 \begin{translation}
2806 First § of the translation.
2807 \end{translation}
2808 \begin{edition}
2809 Second § of the edition text.
2810 \end{edition}
2811 \begin{translation}
2812 Second § of the translation.
2813 \end{translation}
2814 \end{alignment}
2815 \end{minted}
2816 % \iffalse
2817 %</example>
2818 % \fi
2819 %
2820 % \DescribeEnv{edition*}
2821 % \DescribeEnv{translation*}
2822 % \phts\label{ref:starred-envs} Furthermore, so-called
2823 % \enquote{starred} versions of these environments can be used at any
2824 % point to synchronize texts, that is to print them in such a way that
2825 % the tops of all paragraphs are vertically aligned. To that effect,
2826 % it must be noted that merely applying this command on a single
2827 % environment\---for instance the leftmost one\---will have all other
2828 % associated paragraphs printed aligned.
2829 %
2830 % \danger While the whole edition text and the whole translation can
2831 % be inserted in a single \env{edition}/\env{translation} environment
2832 % respectively, it is recommended to enter both texts paragraph by
2833 % paragraph as shown in the example above. Not only this method of
2834 % encoding allows not to lose sight of paragraphs that are meant to be
2835 % read together, but it is also the only way to align paragraphs in
2836 % print, and it is much more suitable to mark up correspondence
2837 % between spans of texts.
2838 %
2839 % As an illustration, a short extract of Caesar's \emph{Gallic War},
2840 % VI, XIII.1 follows.\footnote{Latin text: \cite{Caesar-BG-v2};
2841 % English translation: \cite{CaesarTr}.} See the list of sigla for
2842 % manuscripts and manuscript families above
2843 % \vpageref{ref:caesar-bg-sigla}. As this document is not set for
2844 % duplex printing, both texts have been put together on the same
2845 % page. However, the reader will find the full |.tex| source file in
2846 % \vref{sec:caesar-gw-tex} and \texttt{TEI xml} output in
2847 % \vref{sec:caesar-gw-tei}. The corresponding PDF output is available
2848 % in \href{samples/Caesar_BG-6-13-1.pdf}{a separate file}:\footnote{On
2849 % the use of \cs{ekddiv} (ll.~3 and 20), see below
2850 % \vref{sec:ekddiv}.}---
2851 %
2852 % \captof{Caesar's \emph{Gallic War}, VI, 13.1}[\label{lst:caesar-bg}]
2853 % \iffalse
2854 %<*example>
2855 % \fi
2856 \begin{minted}{latex}
2857 \begin{alignment}
2858 \begin{edition}
2859 \ekddiv{head=XIII, depth=2, n=6.13, type=section}
2860 In omni Gallia eorum hominum qui \app{
2861 \lem[wit=a]{aliquo}
2862 \rdg[wit=b, alt=in al-]{in aliquo}}
2863 sunt numero atque honore genera sunt duo. Nam plebes paene
2864 seruorum habetur loco, quae \app{
2865 \lem[wit={A,M}, alt={nihil audet (aut et \getsiglum{A1})
2866 per se}]{nihil audet per se}
2867 \rdg[wit=A1,nordg]{nihil aut et per se}
2868 \rdg[wit={R,S,L,N}]{nihil habet per se}
2869 \rdg[wit=b]{per se nihil audet}}, \app{
2870 \lem[wit=a]{nullo}
2871 \rdg[wit=b]{nulli}} adhibetur \app{
2872 \lem{consilio}
2873 \rdg[wit={T, U}, alt=conc-]{concilio}}.
2874 \end{edition}
2875 \begin{translation}
2876 \ekddiv{head=XIII, depth=2, n=6.13, type=section}
2877 Throughout all Gaul there are two orders of those men who are of
2878 any rank and dignity: for the commonality is held almost in the
2879 condition of slaves, and dares to undertake nothing of itself,
2880 and is admitted to no deliberation.
2881 \end{translation}
2882 \end{alignment}
2883 \end{minted}
2884 % \iffalse
2885 %</example>
2886 % \fi
2887 %
2888 % \begingroup
2889 % \needspace{7\baselineskip}
2890 % \resetlinenumber
2891 % \FormatDiv{2}{}{.}
2892 % \begin{alignment}[flush,lcols=2,
2893 % texts=edition[xml:lang="la"];
2894 % translation[xml:lang="en"]]
2895 % \AtBeginEnvironment{edition}{\selectlanguage{latin}}
2896 % \AtBeginEnvironment{translation}{\selectlanguage{american}}
2897 % \begin{edition}
2898 % \ekddiv{head=XIII, depth=2, n=6.13, type=section}
2899 % In omni Gallia eorum hominum qui \app{
2900 % \lem[wit=ca]{aliquo}
2901 % \rdg[wit=cb, alt=in al-]{in aliquo}}
2902 % sunt numero atque honore genera sunt duo. Nam plebes paene
2903 % seruorum habetur loco, quae \app{
2904 % \lem[wit={cA,cM}, alt={nihil audet (aut et \getsiglum{cA1})
2905 % per se}]{nihil audet per se}
2906 % \rdg[wit=cA1,nordg]{nihil aut et per se}
2907 % \rdg[wit={cR,cS,cL,cN}]{nihil habet per se}
2908 % \rdg[wit=cb]{per se nihil audet}}, \app{
2909 % \lem[wit=ca]{nullo}
2910 % \rdg[wit=cb]{nulli}} adhibetur \app{
2911 % \lem{consilio}
2912 % \rdg[wit={cT, cU}, alt=conc-]{concilio}}.
2913 % \end{edition}
2914 % \begin{translation}
2915 % \ekddiv{head=XIII, depth=2, n=6.13, type=section}
2916 % Throughout all Gaul there are two orders of those men who are of
2917 % any rank and dignity: for the commonality is held almost in the
2918 % condition of slaves, and dares to undertake nothing of itself,
2919 % and is admitted to no deliberation.
2920 % \end{translation}
2921 % \end{alignment}
2922 % \endgroup
2923 %
2924 % \begin{remarks}
2925 % \item As can be seen from the apparatus entry related to l.~4 above,
2926 % a subvariant has been inserted in the lemma part: \enquote{(aut et
2927 % \getsiglum{cA1})}. This was done by using |alt| in
2928 % \vref{lst:caesar-bg}, ll.~9--10. But as this variant is already
2929 % recorded\---and printed\---in the lemma part, it was necessary to
2930 % remove the entire otherwise redundant variant from the apparatus
2931 % criticus in print. Hence the use of |nordg| at l.~11.
2932 % \item For examples of abbreviations, see ll.~6 and 17.
2933 % \item Line~17 shows how mss.\ T and U (which belong to two distinct
2934 % subfamilies) have been separated from one another: %
2935 % \verb*+wit={T, U}+. See above \vpageref{ref:mss-sep-families} for
2936 % more information on this technique.
2937 % \end{remarks}
2938 %
2939 % Finally, the corresponding \texttt{TEI xml} output follows:---
2940 %
2941 % \iffalse
2942 %<*example>
2943 % \fi
2944 \begin{minted}[linenos=false]{xml}
2945 <div xml:id="div-edition_1" xml:lang="la">
2946 <div type="section" n="6.13">
2947 <head>XIII</head>
2948 <p>In omni Gallia eorum hominum qui
2949 <app>
2950 <lem wit="#A #M #B #R #S #L #N">aliquo</lem>
2951 <rdg wit="#T #f #U #l">in aliquo</rdg>
2952 </app>sunt numero atque honore genera sunt duo. Nam
2953 plebes paene seruorum habetur loco, quae
2954 <app>
2955 <lem wit="#A #M">nihil audet per se</lem>
2956 <rdg wit="#A1">nihil aut et per se</rdg>
2957 <rdg wit="#R #S #L #N">nihil habet per se</rdg>
2958 <rdg wit="#T #f #U #l">per se nihil audet</rdg>
2959 </app>,
2960 <app>
2961 <lem wit="#A #M #B #R #S #L #N">nullo</lem>
2962 <rdg wit="#T #f #U #l">nulli</rdg>
2963 </app>adhibetur
2964 <app>
2965 <lem>consilio</lem>
2966 <rdg wit="#T #U">concilio</rdg>
2967 </app>.</p>
2968 </div>
2969 </div>
2970 <div xml:id="div-translation_1" xml:lang="en">
2971 <div type="section" n="6.13">
2972 <head>XIII</head>
2973 <p>Throughout all Gaul there are two orders of those men
2974 who are of any rank and dignity: for the commonality is
2975 held almost in the condition of slaves, and dares to
2976 undertake nothing of itself, and is admitted to no
2977 deliberation.</p>
2978 </div>
2979 </div>
2980 \end{minted}
2981 % \iffalse
2982 %</example>
2983 % \fi
2984 %
2985 % \subsection{Alignment of Several Texts}
2986 % \label{sec:multiple-alignment}
2987 % As described above \vpageref{ref:alignment-syntax}, the
2988 % \env{alignment} environment may receive an optional argument in
2989 % which
2990 % the following \enquote{name$=$value} arguments are accepted:---\\
2991 % \DescribeOption{tcols}
2992 % |tcols|$=$\meta{number}\hfill\tcboxverb{Default: 2}\\
2993 % |tcols| stores the \underLine{t}otal number of
2994 % \underLine{col}umn\underLine{s} of text to be aligned.\\
2995 % \DescribeOption{lcols}
2996 % |lcols|$=$\meta{number}\hfill\tcboxverb{Default: 1}\\
2997 % |lcols| stores the number of \underLine{col}umn\underLine{s} to be
2998 % printed on the \underLine{l}eft-hand page, \emph{out of the total
2999 % number} of columns specified with |tcols|. As can be seen from the
3000 % preceding two default values, \env{alignment} initially sets two
3001 % columns of text on facing pages. Of course, for this setting to work
3002 % properly, one must ensure that the \env{alignment} environment is
3003 % started on a
3004 % left page.\\
3005 % \DescribeOption{texts}
3006 % |texts|$=$\meta{\underLine{semicolon}-separated
3007 % values}\hfill\tcboxverb{Default: edition;translation}\\
3008 % Depending on the total number of columns that has been specified
3009 % with |tcols| above, |texts| is then used to define the names of the
3010 % environments that shall receive edition texts, translations,
3011 % \emph{\&c.} Furthermore, as described \vpageref{ref:starred-envs},
3012 % \pkg{ekdosis} also defines \enquote{starred} versions of these
3013 % environments to be used to synchronize columns so that corresponding
3014 % paragraphs are printed vertically aligned. Some very important
3015 % points need to be emphasized in this respect:---
3016 % \begin{enumerate}
3017 % \item Only unaccented letters of the alphabet (whatever the case)
3018 % are allowed to compose the names of \LaTeX{} environments.
3019 % \item These names must be separated from one another by
3020 % \emph{semicolons}, as shown in red in the listing below at the end
3021 % of lines~1 and 2.
3022 % \begin{enumerate}
3023 % \item[\dbend] The comma at the end of line~3 closes the whole
3024 % value of |text| and acts as a higher level separator.
3025 % \end{enumerate}
3026 % \item \phts\label{it:lang-subopt} Each name may be followed by a
3027 % \enquote*{suboptional} argument between square brackets which will
3028 % then be used to insert \texttt{TEI xml} attributes in the
3029 % corresponding |<div>| element. For example, \iffalse
3030 %<*example>
3031 % \fi
3032 \begin{minted}[escapeinside=++]{latex}
3033 texts=latin[xml:lang="la"]+\textcolor{red}{;}+
3034 english[xml:lang="en"]+\textcolor{red}{;}+
3035 french[xml:lang="fr"]+\textcolor{red}{,}+
3036 \end{minted}
3037 % \iffalse
3038 %</example>
3039 % \fi
3040 % will be converted into \texttt{TEI xml} as follows:---
3041 % \iffalse
3042 %<*example>
3043 % \fi
3044 \begin{minted}[linenos=false]{xml}
3045 <div xml:id="div-latin_1" xml:lang="la">
3046 ...
3047 </div>
3048 <div xml:id="div-english_1" xml:lang="en">
3049 ...
3050 </div>
3051 <div xml:id="div-french_1" xml:lang="fr">
3052 ...
3053 </div>
3054 \end{minted}
3055 % \iffalse
3056 %</example>
3057 % \fi
3058 % \begin{enumerate}
3059 % \item[\dbend] As can be seen, \pkg{ekdosis} takes care of
3060 % computing and inserting the |xml:id| attributes which are
3061 % therefore not accepted in the \enquote*{suboptional} arguments
3062 % of |texts|.
3063 % \end{enumerate}
3064 % \item The names of the environments must be specified in exactly the
3065 % same order as they are supposed to appear in the print edition,
3066 % from left to right.
3067 % \end{enumerate}
3068 % \DescribeOption{apparatus}
3069 % |apparatus|$=$\meta{\underLine{semicolon}-separated
3070 % values}\hfill\tcboxverb{Default: edition}\\
3071 % Then, the |apparatus| option, just as |texts|, takes a
3072 % \underLine{semicolon}-separated list of previously defined
3073 % environments that shall receive at least one layer of apparatus
3074 % criticus.\\
3075 % \DescribeOption{paired} |paired|$=$\verb+true|false+%
3076 % \hfill\tcboxverb{Default: true (initially not set)}\\
3077 % This named argument does not need a value as it defaults to |true|
3078 % if used. By default, \pkg{ekdosis} follows the \LaTeX{} page
3079 % numbering scheme when multiple texts are arranged on facing
3080 % pages. The |paired| option leaves every right-hand page number
3081 % unchanged, so that both facing pages hold the same page number.\\
3082 % \DescribeOption{lineation} |lineation|$=$\verb+page|document+
3083 % \hfill\tcboxverb{Default: document}\\
3084 % This option applies to edition texts initially set to receive an
3085 % apparatus criticus. By default, lines are continuously numbered
3086 % throughout the document. |lineation=page| sets the numbering to
3087 % start afresh at the top of each page.\\
3088 % \DescribeOption{flush} |flush|$=$\verb+true|false+
3089 % \hfill\tcboxverb{Default: false}\\
3090 % This named argument does not need a value as it defaults to |true|
3091 % if used. This option applies when two or more distinct
3092 % \env{alignment} environments are started on the same page. Should
3093 % this happen, any subsequent \env{alignment} environment must be set
3094 % with the |flush| option so that every one of them carry its own
3095 % apparatus criticus.
3096 %
3097 % As an example, the alignment of the Latin edition text of Caesar's
3098 % \emph{Gallic War}, printed on left-hand pages, along with two
3099 % translations into English and French, printed on right-hand pages,
3100 % can be set as follows:---
3101 % \iffalse
3102 %<*example>
3103 % \fi
3104 \begin{minted}[linenos=false]{latex}
3105 \begin{alignment}[tcols=3,
3106 lcols=1,
3107 texts=latin[xml:lang="la"];
3108 english[xml:lang="en"];
3109 french[xml:lang="fr"],
3110 apparatus=latin,
3111 lineation=page]
3112 \begin{latin}
3113 Gallia est omnis divisa in partes tres quarum unam incolunt
3114 Belgae, [...]
3115 \end{latin}
3116 \begin{english}
3117 All Gaul is divided into three parts, one of which the Belgae
3118 inhabit, [...]
3119 \end{english}
3120 \begin{french}
3121 L'ensemble de la Gaule est divisé en trois parties: l'une est
3122 habitée par les Belges, [...]
3123 \end{french}
3124 \end{alignment}
3125 \end{minted}
3126 % \iffalse
3127 %</example>
3128 % \fi
3129 %
3130 % \DescribeMacro{\SetAlignment}
3131 % \cs{SetAlignment}\marg{alignment settings}\\
3132 % If the same alignment settings be shared by several \env{alignment}
3133 % environments, common settings can be collected in the argument of
3134 % \cs{SetAlignment}, like
3135 % so:---\\
3136 % \iffalse
3137 %<*example>
3138 % \fi
3139 \begin{minted}[linenos=false]{latex}
3140 \SetAlignment{
3141 tcols=3,
3142 lcols=1,
3143 texts=latin[xml:lang="la"];
3144 english[xml:lang="en"];
3145 french[xml:lang="fr"],
3146 apparatus=latin,
3147 lineation=page
3148 }
3149 \begin{alignment}
3150 ...
3151 \end{alignment}
3152 \end{minted}
3153 % \iffalse
3154 %</example>
3155 % \fi
3156 %
3157 % \cs{SetAlignment} can be used either in the preamble or at
3158 % any point of the document to set or to modify alignment settings.
3159 %
3160 % \subsubsection{Appending Hooks to Environments}
3161 % \label{sec:alignment-hooks}
3162 % \DescribeMacro{\AtBeginEnvironment} Once environments corresponding
3163 % to texts to be aligned have been defined, it is advisable to use the
3164 % \cs{AtBeginEnvironment}\marg{environment}\marg{code} command to
3165 % further adjust languages, hyphenation rules, and/or fonts to be
3166 % applied in each environment. To return to the example provided
3167 % above, once \cs{SetAlignment} has been used, the languages can be
3168 % set as follows:---
3169 %
3170 % \iffalse
3171 %<*example>
3172 % \fi
3173 \begin{minted}[linenos=false]{latex}
3174 \AtBeginEnvironment{latin}{\selectlanguage{latin}}
3175 \AtBeginEnvironment{english}{\selectlanguage{english}}
3176 \AtBeginEnvironment{french}{\selectlanguage{french}}
3177 \end{minted}
3178 % \iffalse
3179 %</example>
3180 % \fi
3181 %
3182 % \subsection{Laying Out Parallel Texts}
3183 % \label{sec:laying-out-parallel}
3184 % As \pkg{ekdosis} uses the \pkg{paracol} package for the layout of
3185 % parallel texts, most of the commands provided by this package
3186 % apply. In this respect, quite useful are the commands described in
3187 % sections 7.3 to 7.6 on pp.~15--21 of the documentation of this
3188 % package.\footcite{paracol}
3189 %
3190 % \danger It must be noted that all these commands are to be inserted
3191 % \emph{before} the \env{alignment} environments on which they are
3192 % supposed to operate.
3193 %
3194 % \subsubsection{Columns and Gutters}
3195 % \label{sec:columns-gutters}
3196 %
3197 % \paragraph{Column Ratio on Single Pages}
3198 % \DescribeMacro{\columnratio}
3199 % \cs{columnratio}\marg{r\textsubscript{1}, r\textsubscript{2}, \dots\
3200 % , r\textsubscript{n}}, where \emph{r\textsubscript{1}} refers to the
3201 % leftmost column, can be used to set the ratio of the columns in
3202 % relation to each other. Depending on the total number of columns on
3203 % which one wishes to operate, a comma-separated list of decimal
3204 % numbers is expected. As an example, \cs{columnratio}|{0.6}| will
3205 % instruct \pkg{ekdosis} to have the first column spread over 60~\% of
3206 % the total width of the text block, minus the total width of
3207 % intercolumnar gutters.
3208 %
3209 % \paragraph{Column Ratio on Facing Pages}
3210 % \cs{columnratio} accepts an optional argument which can be used as
3211 % described above to set the ratio of columns to be printed on
3212 % right-hand pages, like so: \cs{columnratio}\marg{r\textsubscript{1},
3213 % r\textsubscript{2}, \dots\ ,
3214 % r\textsubscript{n}}\oarg{r\textsubscript{1}, r\textsubscript{2},
3215 % \dots\ , r\textsubscript{n}}.
3216 %
3217 % \paragraph{Column Width on Single Pages}
3218 % \DescribeMacro{\setcolumnwidth}
3219 % \cs{setcolumnwidth}\marg{w\textsubscript{1}, w\textsubscript{2},
3220 % \dots\ , w\textsubscript{n}} operates the same way as
3221 % \cs{columnratio} described above, except that dimensions are
3222 % expected instead of ratios. As an example,
3223 % \cs{setcolumnwidth}|{1in}| will have the width of the first column
3224 % set to \unit[1]{in}.
3225 %
3226 % \paragraph{Gutter Width}
3227 % Each value accepted by \cs{setcolumnwidth} can be expressed as a
3228 % pair as in
3229 % \cs{setcolumnwidth}\marg{w\textsubscript{1}/g\textsubscript{1},
3230 % w\textsubscript{2}/g\textsubscript{2}, \dots\ ,
3231 % w\textsubscript{n}/g\textsubscript{n}} where the character |/| acts
3232 % as a separator, in which case \emph{g\textsubscript{x}} is used to
3233 % set the width of the gutter that follows the
3234 % \emph{x}\textsuperscript{th} column. As an example,
3235 % \cs{setcolumnwidth}|{1in/0.25in}| will print a
3236 % \unit[1]{in} first column, followed by a \unit[0.25]{in} gutter.
3237 %
3238 % \paragraph{Automatically Computed Values}
3239 % Widths of columns and widths of gutters can be replaced with
3240 % \cs{fill} and \cs{columnsep} respectively. As an example,
3241 % \cs{setcolumnwidth}|{\fill/0.25|\allowbreak|in}| will only operate
3242 % on the width that follows the first column, all remaining values
3243 % being computed automatically.
3244 %
3245 % \paragraph{Column and Gutter Width on Facing Pages}
3246 % Just like \cs{columnratio}, \cs{setcolumnwidth} accepts an optional
3247 % argument which can be used to set the width of columns and gutters
3248 % to be printed on right-hand pages, like so:
3249 % \cs{setcolumnwidth}\marg{w\textsubscript{1}, w\textsubscript{2},
3250 % \dots\ , w\textsubscript{n}}\oarg{w\textsubscript{1},
3251 % w\textsubscript{2}, \dots\ , w\textsubscript{n}} for columns only,
3252 % and \cs{setcolumnwidth}\marg{w\textsubscript{1}/g\textsubscript{1},
3253 % w\textsubscript{2}/g\textsubscript{2}, \dots\ ,
3254 % w\textsubscript{n}/g\textsubscript{n}}%
3255 % \oarg{w\textsubscript{1}/g\textsubscript{1},
3256 % w\textsubscript{2}/g\textsubscript{2}, \dots\ ,
3257 % w\textsubscript{n}/g\textsubscript{n}} for columns and gutters.
3258 %
3259 % \paragraph{Vertical Rules}
3260 % Vertical rules between columns can be drawn by setting the length of
3261 % the \LaTeX\ \cs{columnseprule} register to a non-zero value, like
3262 % so:---
3263 %
3264 % \iffalse
3265 %<*example>
3266 % \fi
3267 \begin{minted}[linenos=false]{latex}
3268 \setlength{\columnseprule}{0.4pt}
3269 \end{minted}
3270 % \iffalse
3271 %</example>
3272 % \fi
3273 %
3274 % \subsubsection{Marginal Notes}
3275 % \label{sec:marginal-notes}
3276 % By default, marginal notes that refer to the first column are
3277 % printed in the left margin, while notes that refer to subsequent
3278 % columns are printed in the right margin.
3279 %
3280 % \DescribeMacro{\marginparthreshold} \cs{marginparthreshold}\marg{n},
3281 % where \emph{n} is an integer, can be used to change the default
3282 % settings. This command instructs \pkg{ekdosis} that columns of text,
3283 % up to the \emph{n}\textsuperscript{th} column included, shall have
3284 % their marginal notes printed to the left. As a result, to take an
3285 % example, \cs{marginparthreshold}|{0}| will have all marginal notes
3286 % printed in the right margin. \cs{marginparthreshold} also accepts an
3287 % optional argument, namely
3288 % \cs{marginparthreshold}\allowbreak\marg{n}\oarg{n'}, that can be
3289 % used to set the threshold for columns printed in right-hand pages.
3290 %
3291 % \subsubsection{Regular Footnotes}
3292 % \label{sec:regular-footnotes}
3293 % \DescribeMacro{\footnotelayout} By default, regular footnotes are
3294 % printed at the bottom of the column on which they are
3295 % called. \cs{footnotelayout}\marg{key-letter} can be used to change
3296 % this setting. This command accepts as mandatory argument a
3297 % key-letter which can be either |c|, |p| or |m|. |c| means
3298 % \emph{column-wise} footnotes, which is the default value. |p| means
3299 % \emph{page-wise}: footnotes from all columns are gathered in a
3300 % single spanning block at the bottom of the page. Finally, |m| stands
3301 % for \emph{merge}, which means that all footnotes that are called on
3302 % a given page, including notes that are called outside the
3303 % \env{alignment} environment, are printed in a single spanning block
3304 % at the bottom of the page.
3305 %
3306 % \danger Regular footnotes are printed above the block of critical
3307 % notes. The respective places of these blocks can be interchanged by
3308 % just loading the \pkg{fnpos} package in the
3309 % preamble.\footcite{fnpos}
3310 %
3311 % \section{Laying Out the Apparatus Criticus}
3312 % \label{sec:apparatus-layout}
3313 %
3314 % \subsection{General Hooks}
3315 % \label{sec:general-hooks}
3316 % Some hooks are shared by all layers of notes that are inserted in
3317 % the apparatus criticus (e.g. sources, testimonia, variant readings
3318 % \emph{\&c.})
3319 %
3320 % \DescribeMacro{\SetHooks} \cs{SetHooks}\marg{csv list of hooks} can
3321 % be used either in the preamble or at any point of the document. The
3322 % list of accepted
3323 % hooks at the time of writing follows:---\\
3324 % \DescribeOption{appfontsize} |appfontsize|$=$\meta{command}
3325 % \hfill\tcboxverb{Default: \footnotesize}\\
3326 % This option sets the size of the font to be used in the whole
3327 % apparatus criticus. By default, it is the same as the size used for
3328 % footnotes.\\
3329 % \DescribeOption{refnumstyle} |refnumstyle|$=$\meta{command}
3330 % \hfill\tcboxverb{Default: \bfseries}\\
3331 % |refnumstyle| can be used to set the family, series or shape of the
3332 % font used to print references to line numbers in the apparatus
3333 % criticus. By default, numbers are printed in bold face. As an
3334 % example, |refnumstyle=\normalfont| will have them printed in the
3335 % font and shape selected by default for the document, while
3336 % |refnumstyle=\bfseries\itshape| will have them
3337 % printed in bold and italic.\\
3338 % \DescribeOption{postrefnum} |postrefnum|$=$\meta{command \textbar\
3339 % chars}\hfill\tcboxverb{Default: ~}\\
3340 % |postrefnum| can be used to set what immediately follows the
3341 % reference to line numbers. By default, it is |~|, namely an
3342 % unbreakable space. As an example, |postrefnum=\hskip 0.5em| will
3343 % insert a \unit[0.5]{em} space between the numerals and the beginning
3344 % of all subsequent notes.\\
3345 % \DescribeOption{lemmastyle} |lemmastyle|$=$\meta{command}
3346 % \hfill\tcboxverb{Default: not set}\\
3347 % \newfeature[v1.2] |lemmastyle| can be used to set the family, series
3348 % or shape of the font used to print lemma texts in the apparatus
3349 % criticus. For example, |lemmastyle=|\cs{bfseries} will print all
3350 % instances of lemma text in bold while
3351 % |lemmastyle=|\cs{color}|{blue}| will print them in blue.
3352 % \DescribeOption{readingstyle} |readingstyle|$=$\meta{command}
3353 % \hfill\tcboxverb{Default: not set}\\
3354 % \newfeature[v1.2] |readingstyle| operates in the same way as
3355 % |lemmastyle| but applies to variant readings.\\
3356 % \DescribeOption{familysep} |familysep|$=$\meta{symbol}\verb+|reset+
3357 % \phts\label{ref:familysep}\hfill\tcboxverb{Default: not set}\\
3358 % \newfeature[v1.4] As described above \vpageref{ref:lem-wit},
3359 % multiple witnesses must be recorded in the |wit| optional argument
3360 % of the \cs{lem} and \cs{rdg} commands as comma-separated lists of
3361 % sigla which can be further grouped into families by inserting spaces
3362 % as separators just after commas at specific places. \pkg{ekdosis}
3363 % saves and prints these spaces in the apparatus criticus but can be
3364 % instructed to print any other symbol instead by means of
3365 % |familysep|. For instance, |familysep={,}| has the separating spaces
3366 % replaced with commas and |familysep={,\allowbreak}| does the same
3367 % while further allowing breaks after commas at the end of
3368 % lines. Finally, |familysep=reset| can be used to restore the default
3369 % behavior.\\
3370 % \DescribeOption{initialrule} |initialrule|$=$\meta{command}
3371 % \phts\label{ref:initialrule}\hfill\bgroup\footnotesize
3372 % \tcboxverb{Default: \rule{0.4\columnwidth}{0.4pt} (initially not set)}%
3373 % \egroup \newfeature[v1.2] |initialrule| draws a separating rule
3374 % between the edition text and all subsequent layers of critical
3375 % notes. Of course, this option only makes sense when multiple-layer
3376 % apparatus criticus are set. Therefore, it has no effect on
3377 % single-layer apparatus criticus.\\
3378 % \DescribeOption{noinitialrule}\hfill\tcboxverb{Default: not set}\\
3379 % This is a no-value option. It removes any previously set
3380 % |initialrule|.
3381 %
3382 % An example of the way these hooks may be used is provided below in
3383 % \vref{lst:shak-sonnet1}.
3384 %
3385 % \noindent\textbf{Option Specific to the |layout=keyfloat| Global
3386 % Setting}\footnote{See above \vref{ref:keyfloat-opt}.}\\
3387 % \DescribeOption{keyparopts}%
3388 % \phts\label{ref:keyparopts}|keyparopts|$=$\meta{csv options}
3389 % \hfill\tcboxverb{Default: empty}\\
3390 % \newfeature[v1.3] The comma-separated options that can be used are
3391 % those described in the documentation of the \pkg{keyfloat}
3392 % package.\footcite[sect.~2.3, \ppno~\pnfmt{13--15}]{keyfloat} As an
3393 % example, |keyparopts={ft, tr={made with ekdosis},| %
3394 % \allowbreak|lw=1.2}| will draw a tight frame around the apparatus
3395 % block, have the words \enquote{made with \pkg{ekdosis}} printed
3396 % below this block on the
3397 % right and set its width to |1.2\linewidth|.\\
3398 % \textbf{Options Specific to the |layout=fitapp| Global
3399 % Setting}\footnote{See above \vref{ref:fitapp-opt}.}\\
3400 % \DescribeOption{appheight}%
3401 % \phts\label{ref:appheight}|appheight|$=$\meta{dimension}
3402 % \hfill\tcboxverb{Default: 0.5\textheight}\\
3403 % \newfeature[v1.3] This option is used to change the maximum height
3404 % up to which the apparatus block is allowed to grow before the size
3405 % of the characters is reduced to allow for more entries. The value
3406 % must be a dimension, namely a number followed by a length unit, such
3407 % as |0.65\textheight|, |18cm| or |6in|.\\
3408 % \DescribeOption{fitalgorithm}%
3409 % \phts\label{ref:fitalgorithm}
3410 % \unskip|fitalgorithm|$=$\verb+fontsize|hybrid|areasize|squeeze+
3411 % \hfill\tcboxverb{Default: fontsize}\\
3412 % \newfeature[v1.3] The four algorithms that can be used to have the
3413 % entries inserted in the apparatus criticus fit to the selected
3414 % height are presented here from the tightest to the loosest, that is,
3415 % the slowest to the fastest.\footnote{See \cite[446--449]{tcolorbox}
3416 % for details and illustrative examples.} While it is advisable to
3417 % limit the use of |fontsize| to high quality typesetting for
3418 % camera-ready copies, |areasize| offers a satisfactory settlement
3419 % when speed must be given an advantage for intermediate or draft
3420 % copies. |squeeze| should be avoided as it gives results that are
3421 % offensive to the sight and unacceptable to any reader.
3422 %
3423 % \subsection{Single-Layer Apparatus Criticus}
3424 % \label{sec:single-layer-app}
3425 % \paragraph{Specific Commands}
3426 % Single-layer apparatus criticus can be laid out in a variety of
3427 % ways with the following specialized commands, all of which can be
3428 % used in the preamble or at any point of the document:---
3429 %
3430 % \DescribeMacro{\SetLTRapp}
3431 % \DescribeMacro{\SetRTLapp}
3432 % \cs{SetLTRapp} and \cs{SetRTLapp} are two argument-less commands to
3433 % set the direction of the apparatus criticus, either left-to-right or
3434 % right-to-left.
3435 %
3436 % \DescribeMacro{\SetSeparator} \cs{SetSeparator}\marg{separator} is
3437 % used to change the separator between lemma texts and variant
3438 % readings. By default, the separator is a closing square bracket
3439 % followed by a space (\verb*+] +).
3440 %
3441 % \DescribeMacro{\SetSubseparator}\label{ref:setsubseparator}
3442 % \newfeature[v1.4] \cs{SetSubseparator}\marg{subseparator} is used to
3443 % set or change the \enquote{subseparator} between succeeding variant
3444 % readings. By default, no subseparator is set.
3445 %
3446 % \danger As the subseparator applies to subsequent variant readings
3447 % only, it is naturally preceded by a breakable space. This space can
3448 % be removed by \cs{unskip}. As an example, what follows replaces the
3449 % breakable space with an unbreakable space, then prints a colon as
3450 % subseparator followed by a space:---
3451 %
3452 % \iffalse
3453 %<*example>
3454 % \fi
3455 \begin{minted}[linenos=false]{latex}
3456 \SetSubseparator{\unskip~: }
3457 \end{minted}
3458 % \iffalse
3459 %</example>
3460 % \fi
3461 %
3462 % \danger \DescribeMacro{\ekdsep} \DescribeMacro{\ekdsubsep}
3463 % \phts\label{ref:ekdsep-subsep} Once the separator and if applicable
3464 % the subseparator have been set, they can be accessed by \cs{ekdsep}
3465 % and \cs{ekdsubsep} respectively. It is therefore advisable to use
3466 % these commands instead of the mere symbols at whatever place one
3467 % would have them printed.
3468 %
3469 % \DescribeMacro{\SetBeginApparatus}
3470 % \cs{SetBeginApparatus}\marg{characters\textbar commands} can be used
3471 % to append \meta{characters} or \meta{commands} at the beginning of
3472 % the apparatus block. By default, nothing is appended. For instance,
3473 % |\SetBeginApparatus{\textbf{Apparatus:}}| will append
3474 % \enquote{\textbf{Apparatus:}} at the beginning of the apparatus
3475 % block, while |\SetBeginApparatus{\hskip 1em}| will set an
3476 % indentation of one em.
3477 %
3478 % \DescribeMacro{\SetEndApparatus}\phts\label{ref:setendapparatus}
3479 % \cs{SetEndApparatus}\marg{characters} can be used to append
3480 % \meta{characters} at the end of the apparatus block. By default,
3481 % nothing is appended. \phts\label{ref:ending-dot}As an example of
3482 % use, |\SetEndApparatus{.}| will have a period printed at the end of
3483 % the apparatus as it is customary in some
3484 % editions.\footnote{\label{fn:rm-dots}See also below
3485 % \vpageref{sec:superfluous-dots} on how to remove superfluous dots.}
3486 %
3487 % \DescribeMacro{\SetUnitDelimiter}
3488 % \cs{SetUnitDelimiter}\marg{delimiter} can be used to set the
3489 % delimiter between entries in the apparatus criticus. By default,
3490 % there is no delimiter except a simple space. \meta{delimiter} can be
3491 % a broad space (such as |\hskip 0.75em| for instance as in the OCT
3492 % series) or the divider-sign (‖, as in the Budé series).
3493 %
3494 % \DescribeMacro{\SetDefaultRule}
3495 % By default, \pkg{ekdosis} draws a separating line between the
3496 % edition text and the apparatus criticus. This line is initially
3497 % defined as
3498 % |\rule{0.4\columnwidth}{0.4pt}|. \cs{SetDefaultRule}\marg{line
3499 % definition} can be used in the preamble or at any point of the
3500 % document to change the default setting. Leaving this argument empty
3501 % as in \cs{SetDefaultRule}|{}| removes the line.
3502 %
3503 % \DescribeMacro{\SetApparatusLanguage}
3504 % \phts\label{ref:app-lang}\newfeature[v1.2]
3505 % \cs{SetApparatusLanguage}\marg{languagename} can be used when it is
3506 % needed to apply in the apparatus criticus a language different from
3507 % the one that is selected in the edition text.
3508 %
3509 % \DescribeMacro{\SetApparatusNoteLanguage}
3510 % \phts\label{ref:app-note-lang}\newfeature[v1.3]
3511 % \cs{SetApparatusNoteLanguage}\marg{languagename} can be used when it
3512 % is needed to apply in text entries introduced by the mandatory
3513 % argument of the \cs{note} command as described in
3514 % \vref{ref:type-note}\===namely
3515 % \cs{note}\oarg{options}\marg{text}\===a language different from the
3516 % one that is selected in the edition text.
3517 %
3518 % \paragraph{General Command}
3519 % \DescribeMacro{\SetApparatus} \cs{SetApparatus}\marg{csv list of
3520 % apparatus settings}\phts\label{ref:apparatus-settings-b}\\
3521 % Finally, all the settings described above can also be collected in
3522 % the argument of \cs{SetApparatus}. \cs{SetApparatus} accepts the
3523 % following list of comma-separated |key=value| options:---\\
3524 % \DescribeOption{direction} |direction|$=$\verb+LR|RL+
3525 % \hfill\tcboxverb{Default: LR}\\
3526 % The writing direction of the apparatus criticus, either
3527 % left-to-right (|LR|) or right-to-left (|LR|).\\
3528 % \DescribeOption{sep} |sep|$=$\meta{command \textbar\ chars}
3529 % \hfill\tcboxverb{Default: ]␣}\\
3530 % The separator between lemma texts and variant readings.\\
3531 % \DescribeOption{subsep} |subsep|$=$\meta{command \textbar\ chars}
3532 % \hfill\tcboxverb{Default: not set}\\
3533 % The \enquote{subseparator} between succeeding variant readings.\\
3534 % \DescribeOption{delim} |delim|$=$\meta{delimiter}
3535 % \hfill\tcboxverb{Default: not set}\\
3536 % The delimiter between entries in the apparatus criticus. As said
3537 % above, there is no default delimiter except a simple space.\\
3538 % \DescribeOption{bhook} |bhook|$=$\meta{characters\textbar commands}
3539 % \hfill\tcboxverb{Default: empty}\\
3540 % The characters or commands to be appended at the beginning of the
3541 % apparatus block.\\
3542 % \DescribeOption{ehook} |ehook|$=$\meta{characters}
3543 % \hfill\tcboxverb{Default: empty}\\
3544 % The characters to be appended at the end of the apparatus
3545 % block.\footnote{See also n.~\vref{fn:rm-dots}.}\\
3546 % \DescribeOption{rule} |rule|$=$\meta{command}
3547 % \hfill\tcboxverb{Default: \rule{0.4\columnwidth}{0.4pt}}\\
3548 % As described above, |rule| is used to draw the separating line
3549 % between the edition text and the apparatus criticus.\\
3550 % \DescribeOption{norule}\hfill\tcboxverb{Default: not set}\\
3551 % |norule| does not accept any value and is used to remove the
3552 % line.\\
3553 % \DescribeOption{lang} |lang|$=$\meta{languagename}
3554 % \newfeature[v1.2]\phts\label{ref:app-lang-opt}
3555 % \hfill\tcboxverb{Default: not set}\\
3556 % |lang=<languagename>| is used as described
3557 % \vpageref[above]{ref:app-lang} when it is needed to apply in the
3558 % apparatus criticus a language different from the one that is
3559 % selected in the edition text. |languagename| can be any value
3560 % accepted by \pkg{babel} or \pkg{polyglossia}.
3561 % \DescribeOption{notelang} |notelang|$=$\meta{languagename}
3562 % \newfeature[v1.3]\phts\label{ref:app-note-lang-opt}
3563 % \hfill\tcboxverb{Default: not set}\\
3564 % |notelang=<languagename>| is used as described
3565 % \vpageref[above]{ref:app-note-lang} when is needed to apply in text
3566 % entries introduced by the mandatory argument of the \cs{note}
3567 % command as described in \vref{ref:type-note}\===namely
3568 % \cs{note}\oarg{options}\marg{text}\===a language different from the
3569 % one that is selected in the edition text. |languagename| can be any
3570 % value accepted by \pkg{babel} or \pkg{polyglossia}.
3571 % \phts\label{ref:apparatus-settings-e}
3572 %
3573 % As an example, an apparatus criticus with references to line numbers
3574 % printed in normal font, a colon as a separator between lemma texts
3575 % and variant readings, a broad space as a delimiter between entries
3576 % and a \unit[0.7]{in} line above could be laid out as follows:---
3577 %
3578 % \phts\label{ex:single-layer-app-layout}
3579 % \iffalse
3580 %<*example>
3581 % \fi
3582 \begin{minted}[linenos=false]{latex}
3583 \SetHooks{
3584 refnumstyle=\normalfont
3585 }
3586 \SetApparatus{
3587 sep={: },
3588 delim=\hskip 1em,
3589 rule=\rule{0.7in}{0.4pt}
3590 }
3591 \end{minted}
3592 % \iffalse
3593 %</example>
3594 % \fi
3595 %
3596 % \paragraph{Footnote Separator}
3597 % \DescribeMacro{\footnoteruletrue} \DescribeMacro{\footnoterulefalse}
3598 % As already seen above, \pkg{ekdosis} takes care of drawing a
3599 % separating line between the edition text and the apparatus
3600 % criticus. Therefore, it may be not desirable to have the standard
3601 % \LaTeX\ \enquote{footnoterule} printed on every page where regular
3602 % footnotes are found. \cs{footnoterulefalse} removes it while
3603 % \cs{footnoteruletrue} leaves it untouched. The latter is set by
3604 % default.
3605 %
3606 % \subsection{Multiple-Layer Apparatus Criticus}
3607 % \label{sec:multilayer-apparatus}
3608 % As said above in \vref{it:multilayer-feature}, \pkg{ekdosis} can
3609 % print edition texts equipped with multiple-layer apparatus
3610 % criticus. To take an example, most classical editions provide at
3611 % least two layers of notes: one to collect references to testimonia
3612 % or parallel passages (apparatus testium) and the other to record
3613 % variant readings (the apparatus criticus \emph{stricto sensu}). The
3614 % former is always printed above the latter.
3615 %
3616 % \danger The default single-layer apparatus criticus that is
3617 % described above in \vref{sec:single-layer-app} is called |default|
3618 % internally. If any additional layer of notes be declared in the
3619 % preamble, this |default| layer must be included in the list of
3620 % declared layers.\\
3621 % \DescribeMacro{\SetDefaultApparatus}\phts\label{ref:ekd-default-app}
3622 % \cs{SetDefaultApparatus}\marg{name} can be used at any point of the
3623 % document to change the name to be used as the default one by
3624 % \pkg{ekdosis}.
3625 %
3626 % \subsubsection{Declaring Additional Layers}
3627 % \label{sec:declaring-layers}
3628 % \DescribeMacro{\DeclareApparatus}
3629 % \cs{DeclareApparatus}\marg{name}\oarg{csv list of apparatus
3630 % settings} is a preamble-only command. As a mandatory argument, it
3631 % takes the name of the new layer of notes to be inserted in the
3632 % apparatus block. Declared layers are then printed one below the
3633 % other in the exact same order as they are declared in the
3634 % preamble. Therefore, one additional layer meant to print the
3635 % testimonia above the variant readings (apparatus testium) can be
3636 % declared as follows:---
3637 %
3638 % \iffalse
3639 %<*example>
3640 % \fi
3641 \begin{minted}{latex}
3642 % preamble:
3643 \DeclareApparatus{testium}
3644 \DeclareApparatus{default}
3645 \end{minted}
3646 % \iffalse
3647 %</example>
3648 % \fi
3649 %
3650 % In this example, |testium| is a new name for |default|, as said
3651 % just above, is already known to \pkg{ekdosis} and used as the
3652 % default layer of notes. Furthermore, as |testium| is declared before
3653 % |default|, \pkg{ekdosis} will print the testimonia at the top of the
3654 % apparatus block.
3655 %
3656 % \subsubsection{Laying Out Layers With The Optional Argument
3657 % of \cs{DeclareApparatus}}
3658 % \label{sec:layout-layers}
3659 % \DescribeOption{direction}
3660 % \DescribeOption{sep}
3661 % \DescribeOption{subsep}
3662 % \DescribeOption{delim}
3663 % \DescribeOption{bhook}
3664 % \DescribeOption{ehook}
3665 % \DescribeOption{rule}
3666 % \DescribeOption{norule}
3667 % \DescribeOption{lang}\phts\label{ref:apps-lang-opt}
3668 % \DescribeOption{notelang}
3669 % With regard to layout, any declared layer inherits the default values
3670 % described above in \vref{sec:single-layer-app}. That said, as the
3671 % optional argument of \cs{DeclareApparatus} accepts the exact same
3672 % |key-value| options as \cs{SetApparatus} described
3673 % \vpagerefrange{ref:apparatus-settings-b}{ref:apparatus-settings-e},
3674 % \pkg{ekdosis} provides a straightforward mechanism to have any layer
3675 % printed in a distinct layout.
3676 %
3677 % To return to the example provided
3678 % \vpageref[above]{ex:single-layer-app-layout}, one could keep the
3679 % same settings as above for the variant readings, declare an
3680 % apparatus testium with a closing square bracket as a separator and
3681 % finally remove the line between the testimonia and the variant
3682 % readings like so:---
3683 %
3684 % \iffalse
3685 %<*example>
3686 % \fi
3687 \begin{minted}[numbersep=6pt]{latex}
3688 \SetHooks{
3689 refnumstyle=\normalfont,
3690 initialrule=\rule{0.7in}{0.4pt}
3691 }
3692 \DeclareApparatus{testium}[
3693 sep={] },
3694 delim=\hskip 1em,
3695 norule
3696 ]
3697 \DeclareApparatus{default}[
3698 sep={: },
3699 delim=\hskip 1em,
3700 rule=\relax
3701 ]
3702 \end{minted}
3703 % \iffalse
3704 %</example>
3705 % \fi
3706 %
3707 % \begin{remarks}
3708 % \item The general hook \texttt{initialrule} used here (l.~3) is
3709 % described above \vpageref{ref:initialrule}.
3710 % \item \cs{relax} (l.~13) is a \TeX\ primitive that instructs to do
3711 % nothing. Therefore, |rule=\relax| is not strictly equivalent to
3712 % |norule|: with the former, \cs{relax} removes the rule but leaves
3713 % untouched the subsequent carriage return: as a result, the layers
3714 % are visually separated from one another by a blank line. With the
3715 % latter everything is removed, carriage return included.
3716 % \end{remarks}
3717 %
3718 % \paragraph{Limiting the Number of Entries per Page}
3719 % \phts\label{ref:maxentries}
3720 % In some instances, it can be useful to set a limit to the number of
3721 % entries per page that a given layer of critical notes may accept,
3722 % notably when entries are so abundant in number that \pkg{ekdosis}
3723 % may oscillate indefinitely between different sets of page decisions
3724 % without being able to settle down.\\
3725 % \DescribeOption{maxentries} |maxentries|=\meta{n} (where $n \geq
3726 % 10$) \hfill\tcboxverb{Default: not set}\\
3727 % If |maxentries|$=$\meta{n} be set, then \pkg{ekdosis} will issue
3728 % \cs{pagebreak} (namely \cs{penalty}|-10000|) just after the
3729 % \emph{n\textsuperscript{th}} entry has been inserted in the layer of
3730 % the apparatus criticus this option is related to. As a result, the
3731 % page will actually break at the end of the current line. The
3732 % particulars of this technique will be discussed below in
3733 % \vref{sec:oscillating-problem}.
3734 %
3735 % \section{Inserting Notes in Multiple-Layer Apparatus}
3736 % \label{sec:notes-in-multilayer-app}
3737 % As said above in \vref{sec:multilayer-apparatus}, \pkg{ekdosis}
3738 % initially sets one layer of notes that is called the
3739 % \textooquote|default|\textcoquote\ layer. As a result, any note
3740 % inserted within the argument of \cs{app}|{}| as described
3741 % \vpageref{ref:app-cmd} will go into that layer of the apparatus,
3742 % unless \cs{SetDefaultApparatus} has been used to set another
3743 % name for the default layer (see above
3744 % \vpageref{ref:ekd-default-app}).
3745 %
3746 % \subsection{Variant Readings}
3747 % \label{sec:variant-readings}
3748 % In most cases, all variant readings go into the
3749 % \textooquote|default|\textcoquote\ layer of the apparatus
3750 % criticus. But in some other cases, for example when the manuscripts
3751 % used refer to different recensions, it may happen that one wishes to
3752 % record the related variants in separate layers. As already described
3753 % \vpageref{ref:app-type}, the |type| optional argument of the
3754 % \cs{app} command can be used to insert lemma texts and associated
3755 % variants in any other \enquote*{declared} layer of the apparatus
3756 % criticus.
3757 %
3758 % The following example assumes that some edition text is received in
3759 % two different recensions and the variant readings that belong to the
3760 % first recension are recorded in the default layer of notes while
3761 % those of the second recension are to be printed in a second layer,
3762 % below the default one. First, both layers must be declared in the
3763 % preamble in sequence, like so:---
3764 %
3765 % \iffalse
3766 %<*example>
3767 % \fi
3768 \begin{minted}[linenos=false]{latex}
3769 \DeclareApparatus{default} % default layer
3770 \DeclareApparatus{rec2} % additional layer below the default one
3771 \end{minted}
3772 % \iffalse
3773 %</example>
3774 % \fi
3775 %
3776 % Should one wish to refer to |rec1| as the default layer, then
3777 % \cs{SetDefaultApparatus} must be used, like so:---
3778 %
3779 % \iffalse
3780 %<*example>
3781 % \fi
3782 \begin{minted}[linenos=false]{latex}
3783 \SetDefaultApparatus{rec1}
3784 \DeclareApparatus{rec1} % new layer set as default
3785 \DeclareApparatus{rec2} % additional layer below the default one
3786 \end{minted}
3787 % \iffalse
3788 %</example>
3789 % \fi
3790 %
3791 % Then, whatever option has been chosen, lemma texts and variants
3792 % inserted with \cs{app}|{}| will go into the upper, default layer of
3793 % notes, while those inserted with \cs{app}|[type=rec2]{}| will go
3794 % into the lower one:---
3795 %
3796 % \iffalse
3797 %<*example>
3798 % \fi
3799 \begin{minted}[linenos=false]{latex}
3800 Some \app{
3801 \lem{word}
3802 \rdg{reading}
3803 } to go into the default layer of notes.
3804
3805 Some \app[type=rec2]{
3806 \lem{note}
3807 \rdg{comment}
3808 } to be recorded as part of the second recension.
3809 \end{minted}
3810 % \iffalse
3811 %</example>
3812 % \fi
3813 %
3814 % \danger At any rate, |type=default| or |type=rec1|, depending on
3815 % what has been chosen, must be used should the editor wish to retain
3816 % that information in the \texttt{TEI xml} output file.
3817 %
3818 % \subsection{Other Notes for Comments, Sources or Testimonia}
3819 % \label{ref:type-note}
3820 % Additional layers of notes can be used to print short comments or to
3821 % record references to texts quoted by the author of the edited text
3822 % or references to the edited text by other authors or
3823 % translators. The former set is called an \emph{apparatus fontium}
3824 % while the latter is called an \emph{apparatus testium}.
3825 %
3826 % \danger From a technical standpoint, these notes are very different
3827 % from the short editorial notes inserted between lemma texts and
3828 % variant readings that have been described above
3829 % \vpageref{ref:editorial-notes}. However, for the sake of consistency
3830 % with \texttt{TEI xml} encoding, \pkg{ekdosis} uses the same command
3831 % \cs{note} to insert both kinds of notes.
3832 %
3833 % \danger One must also keep in mind that the notes that are described
3834 % in this section refer either to a single word or to a span of
3835 % text. By consequence, as boundaries must always be set outside spans
3836 % of text, notes must be inserted immediately before the word or words
3837 % they are related to. As a result of this rule, all spaces subsequent
3838 % to \cs{note} are ignored.
3839 %
3840 % \needspace{2\baselineskip}
3841 % \DescribeMacro{\note} \cs{note}\oarg{options}\marg{text}\\
3842 % As said above, \cs{note}, when found outside \cs{app}|{}|, is used
3843 % to insert in additional layers of the apparatus short comments or
3844 % references to texts quoted or cited in the edition text. It accepts
3845 % the following comma-separated list of |key-value| optional
3846 % arguments:---\\
3847 % \DescribeOption{type} |type|$=$\meta{type}\\
3848 % |type| is used to specify the name of the layer where the note is to
3849 % be printed.\footnote{See \vref{sec:declaring-layers} to learn how to
3850 % declare and lay out new layers of notes.}\\
3851 % \DescribeOption{sep} |sep|$=$\meta{command \textbar\ chars}\\
3852 % The separator between the lemma text and the contents of the note.\\
3853 % \DescribeOption{nosep} |nosep|$=$\verb+true|false+\\
3854 % This named argument does not need a value as it defaults to |true|
3855 % if used. Obviously, |nosep| removes the separator mentioned
3856 % above.\\
3857 % \DescribeOption{lem} |lem|$=$\meta{lemma text}\\
3858 % |lem| is the span of text the note is about. It may consist of one
3859 % or more words, or of an abridged lemma text.\\
3860 % \DescribeOption{num} (no-value argument)\newfeature[v1.3]\\
3861 % |num| takes no value. If used, this argument instructs to print any
3862 % line number that \pkg{ekdosis} may have decided not to print in the
3863 % apparatus criticus before the note.\\
3864 % \DescribeOption{nonum} (no-value argument)\\
3865 % Compared to |num|, |nonum| does the opposite. If used, any number
3866 % that \pkg{ekdosis} may have decided to print before the note
3867 % is suppressed.\\
3868 % \DescribeOption{labelb} |labelb|$=$\meta{label}
3869 % \hfill\tcboxverb{Mandatory}\\
3870 % |labelb| is the unique label to serve as a reference for the point
3871 % immediately preceding the lemma text. \danger |labelb| is used by
3872 % \pkg{ekdosis} to print the line numbers in the apparatus criticus
3873 % and to set the |left()| XPointer should \texttt{TEI} output be
3874 % required. Therefore, it must be specified. Otherwise, \pkg{ekdosis}
3875 % will issue an error message. However, two strictly consecutive
3876 % \cs{note} commands are allowed to share the same |labelb| value for
3877 % it may happen that consecutive notes need to refer to spans of text
3878 % that begin at the exact same location. In this case, \pkg{ekdosis}
3879 % generates only one \cs{linelabel} and one corresponding
3880 % |<anchor>| element in the \texttt{TEI xml} file.\\
3881 % \DescribeOption{labele} |labele|$=$\meta{label}\\
3882 % |labele| is the unique label to serve as a reference for the point
3883 % immediately following the lemma text. Contrary to |labelb|, |labele|
3884 % may be left unspecified if the note be only about one word. If the
3885 % note be about a span, then |labele| must be specified.\\
3886 % \DescribeMacro{\linelabel} \cs{linelabel}\marg{label}\\
3887 % If |labele|$=$\meta{some\_label} be specified in the optional
3888 % argument of \cs{note}, \cs{linelabel}\marg{some\allowbreak\_label}
3889 % must be inserted immediately after the span of text that the note is
3890 % about so that \pkg{ekdosis} can locate the exact point where the
3891 % lemma text addressed by the note ends, like so:---
3892 %
3893 % \iffalse
3894 %<*example>
3895 % \fi
3896 \begin{minted}[linenos=false]{latex}
3897 % Preamble:
3898 % \DeclareApparatus{fontium}[
3899 % delim=\hskip0.75em,
3900 % bhook=\textbf{Sources:},
3901 % ehook=.]
3902 % \DeclareApparatus{default}[
3903 % delim=\hskip0.75em,
3904 % ehook=.]
3905 % Document:
3906 \begin{ekdosis}
3907 The oldest monument of the Germans is their language, which, before
3908 untold centuries, was the companion of their travels from central
3909 Asia; a language, copious, elastic, inviting self-explaining
3910 combinations and independent development; lending itself alike to
3911 daily life and imagination, to description and abstract thought.
3912 \note[type=fontium, labelb=B61e, labele=B62a, lem={They
3913 had... slave}]{Waitz, \emph{Deutsche Verfassungs Geschichte},
3914 i. 86} They had a class of nobles, but their tongue knew no word
3915 for slave.\linelabel{B62a}\footnote{George Bancroft, \emph{History
3916 of the United States from the Discovery of the American
3917 Continent}, II.61--2.}
3918 \end{ekdosis}
3919 \end{minted}
3920 % \iffalse
3921 %</example>
3922 % \fi
3923 %
3924 % PDF output:---
3925 % \medskip
3926 %
3927 % \needspace{7\baselineskip}
3928 % \resetlinenumber
3929 % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
3930 % \begin{specimen}
3931 % The oldest monument of the Germans is their language, which,
3932 % before untold centuries, was the companion of their travels from
3933 % central Asia; a language, copious, elastic, inviting
3934 % self-explaining combinations and independent development;
3935 % lending itself alike to daily life and imagination, to
3936 % description and abstract thought. \note[type=fontium,
3937 % labelb=B61e, labele=B62a, lem={They had... slave}]{Waitz,
3938 % \emph{Deutsche Verfassungs Geschichte}, i. 86} They had a class
3939 % of nobles, but their tongue knew no word for
3940 % slave.\linelabel{B62a}\footnote{George Bancroft, \emph{History of
3941 % the United States from the Discovery of the American Continent},
3942 % II.61--2.}
3943 % \end{specimen}
3944 % \end{alignment}
3945 %
3946 % \texttt{TEI xml} output:---
3947 %
3948 % \iffalse
3949 %<*example>
3950 % \fi
3951 \begin{minted}[linenos=false]{xml}
3952 <p>The oldest monument of the Germans is their language,
3953 which, before untold centuries, was the companion of their
3954 travels from central Asia; a language, copious, elastic,
3955 inviting self-explaining combinations and independent
3956 development; lending itself alike to daily life and
3957 imagination, to description and abstract thought.
3958 <note type="fontium" target="#range(right(B61e),left(B62a))">Waitz,
3959 <emph>Deutsche Verfassungs Geschichte</emph>, i. 86</note>
3960 <anchor xml:id="B61e" />They had a class of nobles, but
3961 their tongue knew no word for slave.
3962 <anchor xml:id="B62a" />
3963 <note place="bottom">George Bancroft,
3964 <emph>History of the United States from the Discovery of
3965 the American Continent</emph>, II.61--2.</note></p>
3966 \end{minted}
3967 % \iffalse
3968 %</example>
3969 % \fi
3970 %
3971 % \paragraph{\cs{note} or \cs{linelabel} inside \cs{lem}}
3972 % It may happen that the \cs{note} or \cs{linelabel} command is found
3973 % inside the argument of \cs{lem}. Obviously, inserting such a command
3974 % in the apparatus criticus in print makes no sense and will lead to
3975 % an error. The solution is to insert in the value of the |alt|
3976 % optional argument of \cs{lem} a duplicate of the lemma text devoid
3977 % of that command, like so:---
3978 %
3979 % \iffalse
3980 %<*example>
3981 % \fi
3982 \begin{minted}[linenos=false]{latex}
3983 This is some \app{
3984 \lem[alt=dummy]{\note[type=fontium, labelb=bnote, labele=enote,
3985 lem=dummy... command]{Text of the note.}
3986 dummy}
3987 \rdg{pseudo}}
3988 text to demonstrate how to insert a note in the argument of the
3989 \emph{lem} command.\linelabel{enote}
3990 \end{minted}
3991 % \iffalse
3992 %</example>
3993 % \fi
3994 %
3995 % PDF output:---
3996 % \medskip
3997 %
3998 % \needspace{7\baselineskip}
3999 % \resetlinenumber
4000 % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
4001 % \begin{specimen}
4002 % This is some \app{
4003 % \lem[alt=dummy]{\note[type=fontium, labelb=bnote, labele=enote,
4004 % lem=dummy... command]{Text of the note.}
4005 % dummy}
4006 % \rdg{pseudo}}
4007 % text to demonstrate how to insert a note in the argument of the
4008 % \emph{lem} command.\linelabel{enote}
4009 % \end{specimen}
4010 % \end{alignment}
4011 %
4012 % \texttt{TEI xml} output:---
4013 %
4014 % \iffalse
4015 %<*example>
4016 % \fi
4017 \begin{minted}{xml}
4018 <p>This is some
4019 <app>
4020 <lem>
4021 <anchor xml:id="bnote" />dummy</lem>
4022 <note type="fontium"
4023 target="#range(right(bnote),left(enote))">Text of the
4024 note.</note>
4025 <rdg>pseudo</rdg>
4026 </app>text to demonstrate how to insert a note in the
4027 argument of the
4028 <emph>lem</emph>command.
4029 <anchor xml:id="#enote" /></p>
4030 \end{minted}
4031 % \iffalse
4032 %</example>
4033 % \fi
4034 %
4035 % As can be seen from the \texttt{TEI xml} output above, the span of
4036 % text the note is about has been carefully delimited by two anchors
4037 % (ll.~4 and 12), the first of which falls within |<lem>| (l.~4), but
4038 % \pkg{ekdosis} has taken care of moving the note itself out of this
4039 % element (ll.~5--7). Otherwise, the \texttt{TEI} output would not be
4040 % valid.
4041 %
4042 % \needspace{4\baselineskip}
4043 % \section{Poetry}
4044 % \label{sec:poetry}
4045 % \subsection[The Standard \textsf{verse} Environment]{The Standard
4046 % \env{verse} Environment}
4047 % \label{sec:stand-verse-env}
4048 %
4049 % In order to typeset verse texts or poems, \LaTeX\ provides the
4050 % standard \env{verse} environment. Within this environment, |\\| is
4051 % normally used to end lines, with the exception of the last line. As
4052 % a result, stanzas are separated from one another by a blank line.
4053 %
4054 % \pkg{ekdosis} provides \env{ekdverse} which is recommended for use
4055 % in place of the standard \env{verse} environment. By default,
4056 % \env{ekdverse} produces the same result as \env{verse}. However,
4057 % \pkg{ekdosis} deviates a little from the standard usage for it needs
4058 % all lines of poetry to be ended by |\\| as a distinct marker. In the
4059 % following listing, stanzas are visually separated from one another
4060 % by an additional vertical space of \unit[2]{ex} (l.~5). Between
4061 % stanzas, |%| is used to prevent \TeX\ from
4062 % introducing a blank line. But a blank line\===or even no blank
4063 % line\===would produce the exact same result:---
4064 %
4065 % \iffalse
4066 %<*example>
4067 % \fi
4068 \begin{minted}{latex}
4069 \begin{ekdverse}
4070 It is an ancient Mariner,\\
4071 And he stoppeth one of three.\\
4072 ‘By thy long grey beard and glittering eye,\\
4073 Now wherefore stopp'st thou me?\\[2ex]
4074 %
4075 The Bridegroom's doors are opened wide,\\
4076 And I am next of kin;\\
4077 The guests are met, the feast is set:\\
4078 May'st hear the merry din.’\\
4079 \end{ekdverse}
4080 \end{minted}
4081 % \iffalse
4082 %</example>
4083 % \fi
4084 %
4085 % PDF output:---
4086 % \medskip
4087 % \SetLineation{vmodulo=0}
4088 % \begingroup
4089 % \needspace{7\baselineskip}
4090 % \resetlinenumber\resetvlinenumber
4091 % \begin{alignment}[flush,tcols=1,texts=coleridge,apparatus=coleridge]
4092 % \begin{coleridge}
4093 % \begin{verse}
4094 % It is an ancient Mariner,\\
4095 % And he stoppeth one of three.\\
4096 % ‘By thy long grey beard and glittering eye,\\
4097 % Now wherefore stopp'st thou me?\\[2ex]
4098 %
4099 % The Bridegroom's doors are opened wide,\\
4100 % And I am next of kin;\\
4101 % The guests are met, the feast is set:\\
4102 % May'st hear the merry din.’\\
4103 % \end{verse}
4104 % \end{coleridge}
4105 % \end{alignment}
4106 % \endgroup
4107 % \SetLineation{vmodulo=1}
4108 % \medskip
4109 %
4110 % \indent\texttt{TEI xml} output:---
4111 %
4112 % \iffalse
4113 %<*example>
4114 % \fi
4115 \begin{minted}[linenos=false]{xml}
4116 <lg>
4117 <l>It is an ancient Mariner,</l>
4118 <l>And he stoppeth one of three.</l>
4119 <l>‘By thy long grey beard and glittering eye,</l>
4120 <l>Now wherefore stopp'st thou me?</l>
4121 <l>The Bridegroom's doors are opened wide,</l>
4122 <l>And I am next of kin;</l>
4123 <l>The guests are met, the feast is set:</l>
4124 <l>May'st hear the merry din.’</l>
4125 </lg>
4126 \end{minted}
4127 % \iffalse
4128 %</example>
4129 % \fi
4130 %
4131 % One would have expected here the |<lg>| element to be used as
4132 % delimiter to encode the stanzaic verse forms. But as can be seen,
4133 % only the outermost level of line group has been converted into
4134 % \texttt{TEI xml}, let alone the vertical spacing between stanzas
4135 % which has been ignored. This is because it is about as much as the
4136 % standard \env{verse} environment provides.
4137 %
4138 % \subsection[The \textsf{verse} Package]{The \pkg{verse} Package}
4139 % \label{sec:verse-package}
4140 % \newfeature[v1.2]
4141 % \pkg{ekdosis} can use the facilities offered by the excellent
4142 % \pkg{verse} package\footcite{verse} to which it adds a specific
4143 % environment for the encoding of line groups such as
4144 % stanzas. Furthermore, as the \pkg{verse} package provides its own
4145 % numbering mechanism, the lines can be numbered independently of
4146 % prose text.\footnote{See \vpageref{ref:verse-lineation} for
4147 % details.}
4148 %
4149 % \danger For what is described in this section to operate,
4150 % \pkg{ekdosis} must be loaded with the global option |poetry=verse|
4151 % as explained above \vpageref{ref:poetry-opt}. Simply loading the
4152 % \pkg{verse} package by means of \cs{usepackage} will have no effect.
4153 %
4154 % \danger The foregoing does not apply if the \cls{memoir} class be
4155 % used.\footcite{memoir} In this case, \pkg{ekdosis} automatically
4156 % uses the code provided by this class without the need to set
4157 % the global option |poetry=verse|.
4158 %
4159 % \paragraph{Compatible Verse Commands}
4160 % The reader is invited to refer to the documentation of the
4161 % \env{verse} package for detailed information. Within the
4162 % \env{ekdverse} environment, |\\| \emph{must be used} at the end of
4163 % each line, as follows:---
4164 % \begin{enumerate}
4165 % \item |\\| is the standard command to be used at the end of each
4166 % line.
4167 % \item |\\!| must be used at the end of stanzas or line groups
4168 % instead of |\\|.
4169 % \item |\\*| does the same as |\\| except that it prohibits a page
4170 % break after the line.
4171 % \item |\\>| \label{ref:vlinebreak-indent}is for line breaks within a
4172 % verse line.
4173 % \item |\\+| \newfeature[v1.4] \label{ref:vlinebreak-noindent}does
4174 % the same as |\\>| but without indenting the subsequent line which
4175 % further complies to any already defined indent pattern.
4176 % \end{enumerate}
4177 %
4178 % All of these commands can take a dimension as optional argument,
4179 % like so: |\\[30pt]|, |\\![30pt]|, |\\*[30pt]|, |\\>[30pt]| or
4180 % |\\+[30pt]|. If |\\|, |\\!|, |\\*| or |\\+| be used, a vertical
4181 % space of the dimension specified is added between lines, whereas
4182 % |\\>[...]| adds an horizontal space after the line break.
4183 %
4184 % \DescribeMacro{\vin} \phts\label{ref:verse-vin}\cs{vin} indents a
4185 % verse line by a length which is by default \unit[1.5]{em}. This
4186 % length is stored as \cs{vgap} and can be changed by \cs{setlength}
4187 % or \cs{addtolength}.
4188 %
4189 % \paragraph{The \env{ekdverse} Environment}
4190 % \DescribeEnv{ekdverse} \cs{begin}|{ekdverse}|\oarg{options} \dots\
4191 % \cs{end}|{ekdverse}|\phts\label{ref:ekdverse-syntax}\\
4192 % This environment is used to hold verse lines as described above and
4193 % may receive an optional argument in which the following
4194 % \enquote{name$=$value} arguments are accepted:---\\
4195 % \DescribeOption{width} |width|$=$\meta{length}
4196 % \hfill\tcboxverb{Default: \linewidth}\\
4197 % If |width| be supplied, it is taken as a length in relation to which
4198 % the entire contents of the environment are to be horizontally
4199 % centered. If given, this dimension may correspond to an average line
4200 % or to the longest line of the line group. To this end, the standard
4201 % \LaTeX\ command \cs{settowidth} can be used, like so:--- %
4202 % \iffalse
4203 %<*example>
4204 % \fi
4205 \begin{minted}[linenos=false]{latex}
4206 \settowidth{\versewidth}{This is the average line,}
4207 \begin{ekdverse}[width=\versewidth]
4208 ...
4209 \end{ekdverse}
4210 \end{minted}
4211 % \iffalse
4212 %</example>
4213 % \fi %
4214 % \begin{remarks}
4215 % \item[\textsc{Rem.}] \cs{versewidth} is provided by the \env{verse}
4216 % package as a convenience and can be used by \env{ekdosis}.
4217 % \end{remarks}
4218 % \DescribeOption{type} |type|$=$\meta{type}
4219 % \hfill\tcboxverb{Default: not set}\\
4220 % This named argument is used in the \texttt{TEI xml} output to
4221 % name the type of unit encoded within the |<lg>| element, viz.\
4222 % \enquote{sonnet}, \enquote{quatrain}, \enquote{couplet} and the
4223 % like.
4224 %
4225 % \danger Unlike the \texttt{TEI xml} element |<lg>|, \env{ekdverse}
4226 % may not nest hiearchichally. Within this environment,
4227 % \env{ekdstanza} must be used instead to encode stanzas as described
4228 % \vpageref[below][below]{ref:ekdstanza}.
4229 %
4230 % As an example, the first five lines of Homer's \emph{Odyssey} could
4231 % be encoded like so:\footcite{HomerMurray}---
4232 %
4233 % \iffalse
4234 %<*example>
4235 % \fi
4236 \begin{minted}[linenos=false]{latex}
4237 \begin{alignment}[tcols=2,
4238 lcols=2,
4239 texts=homer[xml:lang="grc"];murray[xml:lang="en"],
4240 apparatus=homer]
4241 \begin{homer}
4242 \begin{ekdverse}
4243 Ἄνδρα μοι ἔννεπε, Μοῦσα, πολύτροπον, ὃς μάλα πολλὰ \\
4244 πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν· \\
4245 πολλῶν δ' ἀνθρώπων ἴδεν ἄστεα καὶ
4246 \app{\lem{νόον}
4247 \rdg[resp=Zen]{νόμον}
4248 \note{Cf. Schol.}} ἔγνω, \\
4249 πολλὰ δ' ὅ γ' ἐν πόντῳ πάθεν ἄλγεα ὃν κατὰ θυμόν, \\
4250 ἀρνύμενος ἥν τε ψυχὴν καὶ νόστον ἑταίρων. \\
4251 \end{ekdverse}
4252 \end{homer}
4253 \begin{murray}
4254 Tell me, O Muse, of the man of many devices, who wandered full
4255 many ways after he had sacked the sacred citadel of Troy. Many
4256 were the men whose cities he saw and whose mind he learned, aye,
4257 and many the woes he suffered in his heart upon the sea, seeking
4258 to win his own life and the return of his
4259 comrades.
4260 \end{murray}
4261 \end{alignment}
4262 \end{minted}
4263 % \iffalse
4264 %</example>
4265 % \fi
4266 %
4267 % PDF output:---
4268 % \medskip
4269 % \begingroup
4270 % \setcolumnwidth{0.6\textwidth}
4271 % \setlength{\leftmargini}{0em}
4272 % \needspace{7\baselineskip}
4273 % \resetlinenumber\resetvlinenumber
4274 % \begin{alignment}[flush,
4275 % lcols=2,
4276 % texts=homer[xml:lang="grc"];murray[xml:lang="en"],
4277 % apparatus=homer]
4278 % \AtBeginEnvironment{homer}{\selectlanguage{greek}}
4279 % \setlength{\vrightskip}{0.25em}
4280 % \begin{homer}
4281 % \begin{ekdverse}
4282 % Ἄνδρα μοι ἔννεπε, Μοῦσα, πολύτροπον, ὃς μάλα πολλὰ \\
4283 % πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν· \\
4284 % πολλῶν δ' ἀνθρώπων ἴδεν ἄστεα καὶ
4285 % \app{\lem{νόον}
4286 % \rdg[resp=hZen]{νόμον}
4287 % \note{Cf. Schol.}} ἔγνω, \\
4288 % πολλὰ δ' ὅ γ' ἐν πόντῳ πάθεν ἄλγεα ὃν κατὰ θυμόν, \\
4289 % ἀρνύμενος ἥν τε ψυχὴν καὶ νόστον ἑταίρων. \\
4290 % \end{ekdverse}
4291 % \end{homer}
4292 % \begin{murray}
4293 % Tell me, O Muse, of the man of many devices, who wandered full
4294 % many ways after he had sacked the sacred citadel of Troy. Many
4295 % were the men whose cities he saw and whose mind he learned, aye,
4296 % and many the woes he suffered in his heart upon the sea, seeking
4297 % to win his own life and the return of his comrades.
4298 % \end{murray}
4299 % \end{alignment}
4300 % \endgroup
4301 % \medskip
4302 %
4303 % \texttt{TEI xml} output:---
4304 %
4305 % \iffalse
4306 %<*example>
4307 % \fi
4308 \begin{minted}[linenos=false]{xml}
4309 <div xml:id="div-homer_1" xml:lang="grc">
4310 <lg>
4311 <l>Ἄνδρα μοι ἔννεπε, Μοῦσα, πολύτροπον, ὃς μάλα πολλὰ</l>
4312 <l>πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·</l>
4313 <l>πολλῶν δ' ἀνθρώπων ἴδεν ἄστεα καὶ
4314 <app>
4315 <lem>νόον</lem>
4316 <rdg resp="#Zen">νόμον</rdg>
4317 <note>Cf. Schol.</note>
4318 </app>ἔγνω,</l>
4319 <l>πολλὰ δ' ὅ γ' ἐν πόντῳ πάθεν ἄλγεα ὃν κατὰ θυμόν,</l>
4320 <l>ἀρνύμενος ἥν τε ψυχὴν καὶ νόστον ἑταίρων.</l>
4321 </lg>
4322 </div>
4323 <div xml:id="div-murray_1" xml:lang="en">
4324 <p>Tell me, O Muse, of the man of many devices, who
4325 wandered full many ways after he had sacked the sacred
4326 citadel of Troy. Many were the men whose cities he saw and
4327 whose mind he learned, aye, and many the woes he suffered
4328 in his heart upon the sea, seeking to win his own life and
4329 the return of his comrades.</p>
4330 </div>
4331 \end{minted}
4332 % \iffalse
4333 %</example>
4334 % \fi
4335 %
4336 % \paragraph{Stanzas}
4337 % As can be seen above, the \LaTeX\ \env{ekdverse} environment is
4338 % translated into the \texttt{TEI xml} |<lg>| element. The |type|
4339 % attribute may then be used to name the type of unit encoded by this
4340 % element.
4341 %
4342 % \DescribeEnv{ekdstanza} \cs{begin}|{ekdstanza}|\oarg{options} \dots\
4343 % \cs{end}|{ekdstanza}| \phts\label{ref:ekdstanza}\\
4344 % This environment is used within \env{ekdverse} to encode succeeding
4345 % stanzaic forms. Within \env{ekdstanza}, the last line is ended by
4346 % |\\!| or |\\| depending on whether an additional vertical space is
4347 % required between stanzas. This environment may receive an optional
4348 % argument in which the following \enquote{name$=$value} argument is
4349 % accepted:---\\
4350 % \DescribeOption{type} |type|$=$\meta{type}
4351 % \hfill\tcboxverb{Default: not set}\\
4352 % As in the case of \env{ekdverse}, this named argument is used in the
4353 % \texttt{TEI xml} output to name the type of unit encoded within the
4354 % |<lg>| element, viz.\ \enquote{quatrain}, \enquote{couplet} and the
4355 % like.
4356 %
4357 % \paragraph{Indentation Patterns}
4358 % \pkg{ekdosis} can use the \env{patverse} environment and its
4359 % associated command \cs{indentpattern} that are provided by the
4360 % \pkg{verse} package. As described in the documentation of this
4361 % package,\footcite[6]{verse} the indentation pattern consists of an
4362 % array of digits, \emph{d\textsubscript{1}} to
4363 % \emph{d\textsubscript{n}}, where the \emph{n\textsuperscript{th}}
4364 % line is indented by \emph{d\textsubscript{n}} times the amount of
4365 % \cs{vgap} described above \vpageref{ref:verse-vin}.
4366 %
4367 % The overall structure of lines grouped into stanzas may look as
4368 % follows:---
4369 %
4370 % \iffalse
4371 %<*example>
4372 % \fi
4373 \begin{minted}[escapeinside=++]{latex}
4374 \begin{ekdverse}[type={+\emph{overall type}+}]
4375 \identpattern{+\emph{digits}+}
4376 \begin{patverse}
4377 \begin{ekdstanza}[type={+\emph{stanza 1 type}+}]
4378 line 1 \\
4379 line 2 \\
4380 [...]
4381 final line \\!
4382 \end{ekdstanza}
4383 \end{patverse}
4384 \end{ekdverse}
4385 \end{minted}
4386 % \iffalse
4387 %</example>
4388 % \fi
4389 %
4390 % Of course, if no indentation pattern be required or be only required
4391 % occasionally, \env{patverse} (ll.~3 and 10) and \cs{indentpattern}
4392 % (l.~2) are of no use:---
4393 %
4394 % \iffalse
4395 %<*example>
4396 % \fi
4397 \begin{minted}[escapeinside=++]{latex}
4398 \begin{ekdverse}[type={+\emph{overall type}+}]
4399 \begin{ekdstanza}[type={+\emph{stanza 1 type}+}]
4400 line 1 \\
4401 line 2 \\
4402 \vin indented line 3 \\
4403 [...]
4404 final line \\!
4405 \end{ekdstanza}
4406 \end{ekdverse}
4407 \end{minted}
4408 % \iffalse
4409 %</example>
4410 % \fi
4411 %
4412 % A detailed example follows. It is taken from
4413 % \citename{McDonald1916}{editor}'s edition of Shakespeare's
4414 % \emph{Sonnets} from the Quarto of 1609 with variorum
4415 % readings.\footcite[Sonnet~1, \pno~15]{McDonald1916} Compared to
4416 % \citename{McDonald1916}{shorteditor}'s edition, an effort has been
4417 % made to use the typography and punctuation of the original edition
4418 % which can be consulted online at the British Library's
4419 % website.\footnote{Shake-speares \emph{Sonnets}. Neuer before
4420 % Imprinted. (A Louers Complaint. By William
4421 % Shake-speare.). \url{https://www.bl.uk/collection-items/first-edition-of-shakespeares-sonnets-1609}.
4422 % Call number \texttt{C.21.c.44}, fol.~B.} However, this typographical
4423 % refinement has been retained for the sonnet only. For the sake of
4424 % clarity, the line numbers and the apparatus criticus use modern
4425 % typography. The references to line numbers in the apparatus criticus
4426 % have been made consistent with
4427 % \citename{McDonald1916}{shorteditor}'s edition, as have the entries
4428 % in the apparatus criticus, namely the bare line number followed by a
4429 % dot, then the lemma text in bold face, then the variant in italic
4430 % shape:---
4431 %
4432 % \captof{Poetry: Shakespeare's Sonnet~1}[\label{lst:shak-sonnet1}]
4433 % \iffalse
4434 %<*example>
4435 % \fi
4436 \begin{minted}{latex}
4437 \junicode % Use the Junicode font with 'hist' feature enabled for
4438 % long-s
4439 % MacDonald's style for numbers and entries in the apparatus
4440 % criticus:
4441 \SetHooks{
4442 refnumstyle=\normalfont,
4443 postrefnum=.~,
4444 lemmastyle=\bfseries,
4445 readingstyle=\itshape
4446 }
4447 % The lines are to be centered horizontally:
4448 \settowidth{\versewidth}{Feed'st thy lights flame with selfe
4449 substantiall fewell,}
4450 % Format of the outermost <div> element:
4451 \NewDocumentEnvironment{ekdcenter}{}{\par\centering}{\nobreak\par}
4452 \FormatDiv{1}{\begin{ekdcenter}}{\end{ekdcenter}}
4453 \begin{ekdosis}
4454 \ekddiv{type=sonnets, n=1, head=1}
4455 \begin{ekdverse}[type=sonnet, width=\versewidth]
4456 \indentpattern{00000000000011}
4457 \begin{patverse}
4458 \begin{ekdstanza}[type=quatrain]
4459 \ekdlettrine{F}{r}om fairest creatures we desire
4460 increase,\\
4461 That thereby beauties \emph{Rose}
4462 \app{
4463 \lem{might}
4464 \rdg[source={Gildon1710, Sewell1725, Ewing1771}]{may}
4465 } neuer die,\\
4466 But as the riper should by time
4467 \app{
4468 \lem{decease}
4469 \rdg[source=Hudson1856]{decrease}
4470 },\\
4471 His tender heire might beare his memory:\\
4472 \end{ekdstanza}
4473 \begin{ekdstanza}[type=quatrain]
4474 But thou contracted to thine owne bright eyes,\\
4475 Feed'st thy
4476 \app{
4477 \lem{lights}
4478 \rdg[source={Butler1899, Walsh1908}]{life's}
4479 } flame with
4480 \app{
4481 \lem{selfe substantiall}
4482 \rdg[source=Gildon1714,
4483 alt={\textnormal{Hyphened by}}]{selfe-substantiall}
4484 \note{etc.}} fewell,\\
4485 Making a famine where aboundance lies,\\
4486 Thy selfe thy foe,to thy sweet selfe too cruell:\\
4487 \end{ekdstanza}
4488 \begin{ekdstanza}[type=quatrain]
4489 Thou that art now the worlds fresh ornament,\\
4490 And
4491 \app{
4492 \lem{only}
4493 \rdg[resp=God, type=conjecture]{early}
4494 \note{conj.}
4495 } herauld to the gaudy spring,\\
4496 Within thine owne bud buriest thy content,\\
4497 And tender
4498 \app{
4499 \lem{chorle}
4500 \rdg[source=Gildon1710]{churl}
4501 \note{etc.}
4502 } makst wast in niggarding:\\
4503 \end{ekdstanza}
4504 \begin{ekdstanza}[type=couplet]
4505 Pitty the world,or else this glutton be,\\
4506 To eate the worlds due,\app{
4507 \lem{by the}
4508 \rdg[resp=Stee, type=conjecture]{be thy}
4509 \note{conj.}
4510 \rdg[resp=God, type=conjecture]{by thy}
4511 \note{conj.}
4512 } graue
4513 \app{
4514 \lem{and}
4515 \rdg[resp=God, type=conjecture]{as}
4516 \note{conj.}
4517 } thee.\\!
4518 \end{ekdstanza}
4519 \end{patverse}
4520 \end{ekdverse}
4521 \end{ekdosis}
4522 \end{minted}
4523 % \iffalse
4524 %</example>
4525 % \fi
4526 %
4527 % \begin{remarks}
4528 % \item |Gildon1710|, |Gildon1714|, |Sewell1725|, |Ewing1771|,
4529 % |Hudson1856|, |Butler1899| and |Walsh1908| have been declared as
4530 % sources.\footnote{See above \vpageref{ref:declare-source} and
4531 % below \vref{sec:references-cited-works}.} |God| and |Stee|,
4532 % resp.\ Godwin and Steevens, have been declared as
4533 % scholars.\footnote{See above \vpageref{ref:declare-scholar}.}
4534 % \item \cs{ekdlettrine} (l.~23) is a specific command for the
4535 % \pkg{lettrine} package does not work in list
4536 % environments. \cs{TeXtoTEIPat} has been used as described below
4537 % \vpageref{ref:textoteipat} to instruct \pkg{ekdosis} to convert
4538 % this command into an acceptable \texttt{TEI} equivalent. The
4539 % definition of \cs{ekdlettrine} follows:---
4540 % \iffalse
4541 %<*example>
4542 % \fi
4543 \begin{minted}[linenos=false]{latex}
4544 % Preamble:
4545 \usepackage{adjustbox}
4546 % This basic command actually requires an adjustment of the vertical
4547 % space at the end of the current line (eg. \\[-1.875ex]) and \vin at
4548 % the beginning of the next line:---
4549 \NewDocumentCommand{\ekdlettrine}{mm}{%
4550 \adjustbox{valign=t,raise=-0.75ex}{\Huge #1}\textsc{#2}%
4551 }
4552 \TeXtoTEIPat{\ekdlettrine {#1}{#2}}{<hi rend="smallcaps">#1#2</hi>}
4553 \end{minted}
4554 % \iffalse
4555 %</example>
4556 % \fi
4557 % \end{remarks}
4558 %
4559 % PDF output:---
4560 % \medskip
4561 %
4562 % \begingroup
4563 % \junicode
4564 % \SetHooks{
4565 % refnumstyle=\normalfont,
4566 % postrefnum=.~,
4567 % lemmastyle=\bfseries,
4568 % readingstyle=\itshape
4569 % }
4570 % \renewcommand\thelinenumber{}
4571 % \settowidth{\versewidth}{Feed'st thy lights flame with selfe
4572 % substantiall fewell,}
4573 % \FormatDiv{1}{\begin{ekdcenter}}{\end{ekdcenter}}
4574 % \needspace{7\baselineskip}
4575 % \resetlinenumber\resetvlinenumber
4576 % \begin{alignment}[flush,
4577 % tcols=1,
4578 % texts=shakespeare[xml:lang="en"],
4579 % apparatus=shakespeare]
4580 % \setlength{\vrightskip}{-0.75in}
4581 % \begin{shakespeare}
4582 % \ekddiv{type=sonnets, n=1, head=1}
4583 % \begin{ekdverse}[type=sonnet, width=\versewidth]
4584 % \indentpattern{00000000000011}
4585 % \begin{patverse}
4586 % \begin{ekdstanza}[type=quatrain]
4587 % \ekdlettrine{F}{r}om fairest creatures we desire
4588 % increase,\\[-1.875ex]
4589 % \vin That thereby beauties \emph{Rose}
4590 % \app{
4591 % \lem{might}
4592 % \rdg[source={shGildon1710, shSewell1725, shEwing1771}]{may}
4593 % } neuer die,\\
4594 % But as the riper should by time
4595 % \app{
4596 % \lem{decease}
4597 % \rdg[source=shHudson1856]{decrease}
4598 % },\\
4599 % His tender heire might beare his memory:\\
4600 % \end{ekdstanza}
4601 % \begin{ekdstanza}[type=quatrain]
4602 % But thou contracted to thine owne bright eyes,\\
4603 % Feed'st thy
4604 % \app{
4605 % \lem{lights}
4606 % \rdg[source={shButler1899, shWalsh1908}]{life's}
4607 % } flame with
4608 % \app{
4609 % \lem{selfe substantiall}
4610 % \rdg[source=shGildon1714,
4611 % alt={\textnormal{Hyphened by}}]{selfe-substantiall}
4612 % \note{etc.}} fewell,\\
4613 % Making a famine where aboundance lies,\\
4614 % Thy selfe thy foe,to thy sweet selfe too cruell:\\
4615 % \end{ekdstanza}
4616 % \begin{ekdstanza}[type=quatrain]
4617 % Thou that art now the worlds fresh ornament,\\
4618 % And
4619 % \app{
4620 % \lem{only}
4621 % \rdg[resp=shGod, type=conjecture]{early}
4622 % \note{conj.}
4623 % } herauld to the gaudy spring,\\
4624 % Within thine owne bud buriest thy content,\\
4625 % And tender
4626 % \app{
4627 % \lem{chorle}
4628 % \rdg[source=shGildon1710]{churl}
4629 % \note{etc.}
4630 % } makst wast in niggarding:\\
4631 % \end{ekdstanza}
4632 % \begin{ekdstanza}[type=couplet]
4633 % Pitty the world,or else this glutton be,\\
4634 % To eate the worlds due,\app{
4635 % \lem{by the}
4636 % \rdg[resp=shStee, type=conjecture]{be thy}
4637 % \note{conj.}
4638 % \rdg[resp=shGod, type=conjecture]{by thy}
4639 % \note{conj.}
4640 % } graue
4641 % \app{
4642 % \lem{and}
4643 % \rdg[resp=shGod, type=conjecture]{as}
4644 % \note{conj.}
4645 % } thee.\\!
4646 % \end{ekdstanza}
4647 % \end{patverse}
4648 % \end{ekdverse}
4649 % \end{shakespeare}
4650 % \end{alignment}
4651 % \endgroup
4652 %
4653 % \texttt{TEI xml} output:---
4654 % \medskip
4655 %
4656 % \iffalse
4657 %<*example>
4658 % \fi
4659 \begin{minted}[linenos=false]{xml}
4660 <div type="sonnets" n="1">
4661 <head>1</head>
4662 <lg type="sonnet">
4663 <lg type="quatrain">
4664 <l>
4665 <hi rend="smallcaps">Fr</hi>om fairest creatures we
4666 desire increase,</l>
4667 <l>That thereby beauties
4668 <emph>Rose</emph>
4669 <app>
4670 <lem>might</lem>
4671 <rdg source="#Gildon1710 #Sewell1725 #Ewing1771">
4672 may</rdg>
4673 </app>neuer die,</l>
4674 <l>But as the riper should by time
4675 <app>
4676 <lem>decease</lem>
4677 <rdg source="#Hudson1856">decrease</rdg>
4678 </app>,</l>
4679 <l>His tender heire might beare his memory:</l>
4680 </lg>
4681 <lg type="quatrain">
4682 <l>But thou contracted to thine owne bright eyes,</l>
4683 <l>Feed'st thy
4684 <app>
4685 <lem>lights</lem>
4686 <rdg source="#Butler1899 #Walsh1908">
4687 life's</rdg>
4688 </app>flame with
4689 <app>
4690 <lem>selfe substantiall</lem>
4691 <rdg source="#Gildon1714">
4692 selfe-substantiall</rdg>
4693 <note>etc.</note>
4694 </app>fewell,</l>
4695 <l>Making a famine where aboundance lies,</l>
4696 <l>Thy selfe thy foe,to thy sweet selfe too
4697 cruell:</l>
4698 </lg>
4699 <lg type="quatrain">
4700 <l>Thou that art now the worlds fresh ornament,</l>
4701 <l>And
4702 <app>
4703 <lem>only</lem>
4704 <rdg resp="#God" type="conjecture">early</rdg>
4705 <note>conj.</note>
4706 </app>herauld to the gaudy spring,</l>
4707 <l>Within thine owne bud buriest thy content,</l>
4708 <l>And tender
4709 <app>
4710 <lem>chorle</lem>
4711 <rdg source="#Gildon1710">churl</rdg>
4712 <note>etc.</note>
4713 </app>makst wast in niggarding:</l>
4714 </lg>
4715 <lg type="couplet">
4716 <l>Pitty the world,or else this glutton be,</l>
4717 <l>To eate the worlds due,
4718 <app>
4719 <lem>by the</lem>
4720 <rdg resp="#Stee" type="conjecture">be thy</rdg>
4721 <note>conj.</note>
4722 <rdg resp="#God" type="conjecture">by thy</rdg>
4723 <note>conj.</note>
4724 </app>graue
4725 <app>
4726 <lem>and</lem>
4727 <rdg resp="#God" type="conjecture">as</rdg>
4728 <note>conj.</note>
4729 </app>thee.</l>
4730 </lg>
4731 </lg>
4732 </div>
4733 \end{minted}
4734 % \iffalse
4735 %</example>
4736 % \fi
4737 %
4738 % \section{Lineation Settings}
4739 % \label{sec:lineation}
4740 % \danger \pkg{ekdosis} uses \pkg{lineno} internally for line
4741 % numbering.\footcite{lineno} But it must be noted that \pkg{ekdosis}
4742 % strictly prohibits the \enquote{pagewise} mode of operation that is
4743 % provided by \pkg{lineno}. As a result of this hinderance, all
4744 % \enquote{margin switching} functions of \pkg{lineno} are disabled
4745 % within the environments that are specific to \pkg{ekdosis},
4746 % viz. \env{ekdosis} and \env{alignment}.
4747 %
4748 % That said, \pkg{ekdosis} provides equivalents of its own to handle
4749 % the line numbers the same way as \pkg{lineno}'s \enquote{pagewise}
4750 % mode of operation does.
4751 %
4752 % \DescribeMacro{\SetLineation} \cs{SetLineation}\marg{csv list of
4753 % options} may be used in the preamble or at any point of the document
4754 % to set lineation preferences. Its argument processes the |key=value|
4755 % options that follow:---\\
4756 % \textbf{General Options}\\
4757 % \DescribeOption{lineation} |lineation|$=$\verb+page|document|none+
4758 % \hfill\tcboxverb{Default: document}\\
4759 % |lineation=document| has the lines numbered continuously throughout
4760 % the document while |lineation=page| instructs \pkg{ekdosis} that the
4761 % numbering should start afresh at the top of each page. |none| does
4762 % the same as |page| but prevents the numbers from being printed in
4763 % the margins while keeping them in use in the apparatus criticus.\\
4764 % \DescribeOption{modulo} |modulo| \hfill\tcboxverb{Default: not set}\\
4765 % |modulo| does not accept any value. When this option is set, every
4766 % fifth line is numbered.\\
4767 % \DescribeOption{modulonum} |modulonum|$=$\emph{n} (where \emph{n} is
4768 % an integer)\hfill\tcboxverb{Default: not set}\\
4769 % |modulonum| allows to modify the interval between the numbers that
4770 % are printed. |modulo| must be set for this option to have effect. As
4771 % examples, |modulo, modulonum=3| has every third line numbered and
4772 % |modulonum=1| disables modulo numbering.\\
4773 % \DescribeOption{margin} |margin|$=$\verb+right|left|inner|outer+
4774 % \hfill\tcboxverb{Default: left}\\
4775 % |margin| sets the margin in which the line numbers are to be
4776 % printed.\\
4777 % \DescribeOption{numbers} |numbers|$=$\verb+elided|full+
4778 % \hfill\tcboxverb{Default: elided}\\
4779 % This option only has effect on the numbers that are printed in the
4780 % apparatus criticus. |numbers=elided| applies on spans of numbers and
4781 % elides the last number of a range to the fewest number of figures
4782 % possible\---viz. 35--7, 129--31 \emph{\&c.}\---without eliding
4783 % digits in the group 10 to 19 in each hundred\---viz. 17--19, 115--18
4784 % \emph{\&c.} |numbers=full| leaves the numbers untouched.\\
4785 % \DescribeMacro{\innerlinenumbers} \DescribeMacro{\outerlinenumbers}
4786 % \cs{innerlinenumbers} and \cs{outerlinenumbers} are equivalent to
4787 % \cs{SetLineation}|{numb|\allowbreak|ers=outer}| and
4788 % \cs{SetLineation}|{numbers=inner}| respectively. Both commands are
4789 % complementary to \cs{rightlinenumbers} and \cs{leftlinenumbers}
4790 % already provided by the \pkg{lineno} package.\\
4791 % \textbf{Options Specific to the |poetry=verse| Global
4792 % Setting}\footnote{See above
4793 % \vref{sec:verse-package}.}\phts\label{ref:verse-lineation}\\
4794 % \DescribeOption{vlineation} |vlineation|$=$\verb+page|document+
4795 % \hfill\tcboxverb{Default: document}\\
4796 % |vlineation| operates on verse texts in the same way as |lineation|
4797 % on prose texts.\\
4798 % \DescribeOption{vmodulo} |vmodulo|$=$\emph{n} (where \emph{n} is
4799 % an integer)\hfill\tcboxverb{Initially: 1, Default: 5}\\
4800 % |vmodulo|$=$\emph{n} has every \emph{n\textsuperscript{th}} lines of
4801 % verse printed in the margin. If used without value, this option is
4802 % equivalent to |vmodulo=5|. |vmodulo=0| prevents the
4803 % numbers from being printed.\\
4804 % \DescribeOption{vnumbrokenlines}
4805 % |vnumbrokenlines|$=$\verb+true|false+ %
4806 % \hfill\tcboxverb{Initially: false}\\
4807 % \newfeature[v1.4] This named argument does not need a value as it
4808 % defaults to |true| if used. |vnumbrokenlines| has both parts of lines
4809 % broken by |\\>| or |\\+|\footnote{See above
4810 % \vrefrange{ref:vlinebreak-indent}{ref:vlinebreak-noindent} for more
4811 % information.} numbered with the same number for disambiguation
4812 % purposes. By default, only the second part of broken lines is
4813 % numbered.\\
4814 % \DescribeOption{vmargin} |vmargin|$=$\verb+right|left+
4815 % \hfill\tcboxverb{Default: right}\\
4816 % |vmargin| sets the margin in which the verse line numbers are to be
4817 % printed.\\
4818 % \DescribeOption{continuousvnum}\hfill\tcboxverb{Default: not set}\\
4819 % The |poetry=verse| global option has the succeeding lines of verse
4820 % numbered independently of prose text. |continuousvnum| has all lines
4821 % numbered continuously, irrespective of whether they are lines of
4822 % prose or poetry text.
4823 %
4824 % \paragraph{Useful Lineation Commands}
4825 % As implied above, pretty much all commands that are provided by the
4826 % \enquote{running} mode of operation of the \pkg{lineno} package will
4827 % work with \pkg{ekdosis}, notably the following:---\\
4828 % \DescribeMacro{\modulolinenumbers} \cs{modulolinenumbers}\oarg{n}
4829 % can be used to enable or modify modulo line numbering as described
4830 % above.\\
4831 % \DescribeMacro{\resetlinenumber} \cs{resetlinenumber}\oarg{n} resets
4832 % the line number to one or to \emph{n} if specified.\\
4833 % \DescribeMacro{\linenumberfont}
4834 % \cs{renewcommand}|{\linenumberfont}|\marg{commands} can be used to
4835 % set the font used for the line numbers that are printed in the
4836 % margins. By default, the definition is
4837 % \cs{normalfont}\cs{footnotesize}.\\
4838 % \DescribeMacro{\linenumbersep} \cs{linenumbersep} is the distance
4839 % between the numbers and the margin. By default, this distance is set
4840 % to \unit[10]{pt}. It can be redefined like so:
4841 % \cs{setlength}\cs{linenumbersep}\marg{length}.
4842 %
4843 % \paragraph{Poetry Lineation Commands}
4844 % In addition to these commands, if \pkg{ekdosis} be loaded with the
4845 % global option |poetry=verse| as described above in
4846 % \vref{sec:verse-package}, the commands dedicated to line numbering
4847 % that are provided by the \pkg{verse} package can be used.\\
4848 % \DescribeMacro{\vmodulolinenumbers} \newfeature[v1.4]
4849 % \cs{vmodulolinenumbers}\oarg{n} can be used to enable or modify
4850 % verse modulo line numbering as described above.\\
4851 % \DescribeMacro{\resetvlinenumber} \cs{resetvlinenumber}\oarg{n} has
4852 % for lines of verse the same effect as \cs{resetlinenumber} for
4853 % lines of prose text.\\
4854 % \DescribeMacro{\verselinenumfont}
4855 % \cs{verselinenumfont}\marg{commands} can be used to set the font
4856 % used for lines of verse. By default, the definition is
4857 % |\normalfont\footnotesize|.\\
4858 % \DescribeMacro{\vrightskip} The \pkg{verse} package prints the
4859 % numbers at the distance \cs{vrightskip} into the right margin. This
4860 % distance can be redefined by means of \cs{setlength} like so:
4861 % \cs{setlength}\cs{vrightskip}\allowbreak\marg{length}.
4862 %
4863 %
4864 % \paragraph{Labels}
4865 % \DescribeMacro{\linelabel} \DescribeMacro{\ref} In prose as well
4866 % as in poetry texts, \cs{linelabel}\marg{label} sets a line label
4867 % that can be referred to with \cs{ref}\marg{label}.
4868 %
4869 % As an example, what follows has every fifth line number printed in
4870 % the inner margins. Additionally, the numbering shall start afresh at
4871 % the top of each page:---
4872 %
4873 % \iffalse
4874 %<*example>
4875 % \fi
4876 \begin{minted}[linenos=false]{latex}
4877 \SetLineation{
4878 lineation=page,
4879 modulo,
4880 margin=inner
4881 }
4882 \end{minted}
4883 % \iffalse
4884 %</example>
4885 % \fi
4886 %
4887 % \section{Languages}
4888 % \label{sec:languages}
4889 % \danger \pkg{ekdosis} is fully compatible with \pkg{babel}.
4890 % \enquote{Fully compatible} means that all features provided by
4891 % \pkg{babel}, including language switching commands, are supported by
4892 % \pkg{ekdosis}. \pkg{ekdosis} is also compatible with
4893 % \pkg{polyglossia} with one notable exception: \pkg{luabidi}, which
4894 % \pkg{polyglossia} loads for languages written from right to left, is
4895 % not supported by \pkg{ekdosis}, and most probably never will
4896 % be. That said, as far as the author could see, single-layer
4897 % apparatus, as described in \vref{sec:single-layer-app}, can be
4898 % typeset within the Arabic environment that is provided by
4899 % \pkg{polyglossia}. Unfortunately, the same cannot be said for
4900 % multiple-layer apparatus.
4901 %
4902 % Whether \pkg{babel} or \pkg{polyglossia} is used, \pkg{ekdosis}
4903 % automatically applies the current language to the entries of the
4904 % apparatus criticus, including the fonts that may have been
4905 % associated to the languages in the preamble. In this respect, as
4906 % \pkg{polyglossia} can use the same language switching commands as
4907 % \pkg{babel},\footcite[See][3.2 \pno~14]{polyglossia} the general
4908 % advice given above in \vref{sec:alignment-hooks} applies in all
4909 % cases. As regards setting languages in the \texttt{TEI xml} output
4910 % file, the reader is invited to refer to point \vref{it:lang-subopt},
4911 % and \vref{sec:teixml-output} including the example provided
4912 % \vpageref{ref:ancientgreek-ex}.
4913 %
4914 % \danger In some cases, it may be needed to apply in the apparatus
4915 % criticus a language different from the one that is selected in the
4916 % edition text. To this end, \pkg{ekdosis} provides a set of
4917 % facilities which are described
4918 % \vpagerefrange{ref:app-lang}{ref:app-lang-opt} for single-layer
4919 % apparatus and \vpageref{ref:apps-lang-opt} for multiple-layer
4920 % apparatus.
4921 %
4922 % \subsection{Languages Written From Right to Left}
4923 % \label{sec:rtl-languages}
4924 % As said above, \pkg{polyglossia} is not supported by \pkg{ekdosis}
4925 % for languages that are written and read from right to left, like
4926 % Arabic, Hebrew or Syriac. However, as \pkg{babel} is supported and
4927 % can be loaded concurrently with \pkg{polyglossia}, an easy way is to
4928 % use \pkg{babel} to print such languages.
4929 %
4930 % \danger The reader is invited to refer to and become acquainted with
4931 % the relevant parts of the documentation of the \pkg{babel}
4932 % package.\footcite{babel}
4933 %
4934 % \paragraph{\pkg{babel} Only}
4935 % In the following example, \pkg{babel} is used exclusively to set
4936 % three different languages: Arabic, ancient Greek and English:---
4937 %
4938 % \captof{Multilingual editions with \pkg{babel} only}
4939 % \iffalse
4940 %<*example>
4941 % \fi
4942 \begin{minted}{latex}
4943 \usepackage{fontspec}
4944
4945 \usepackage[greek.ancient,english]{babel}
4946 \babelprovide[onchar=fonts]{arabic}
4947
4948 \babelfont{rm}{Old Standard}
4949 \babelfont[greek]{rm}[RawFeature={+ss05;+ss06}]{Old Standard}
4950 \babelfont[*arabic]{rm}{Amiri}
4951
4952 \babeltags{ancientgreek = greek}
4953 \newcommand{\sg}[1]{\textancientgreek{#1}}
4954
4955 \newcommand{\RL}[1]{\bgroup\textdir TRT#1\egroup}
4956 \newenvironment{Arabic}{\par\pardir TRT\textdir TRT}{\par}
4957 \end{minted}
4958 % \iffalse
4959 %</example>
4960 % \fi
4961 %
4962 % \begin{remarks}
4963 % \item As can be seen, \pkg{fontspec} has been loaded before
4964 % \pkg{babel}. To the author's knowledge, this gives better results
4965 % when \cs{babelfont} is used.
4966 % \item Line~3 loads \pkg{babel} and instructs it to use English as
4967 % the default language and ancient Greek as a second optional
4968 % language. The built-in |bidi| mechanism provided by \pkg{babel} is
4969 % not enabled. As a result, specific language switching commands for
4970 % Arabic must be defined just as it must be for every other
4971 % language.
4972 % \item Line~4 does not load any Arabic, but instructs \pkg{babel}
4973 % that it should use the Arabic font that is set below with
4974 % \cs{babelfont} whenever an Arabic letter is encountered.
4975 % \item Lines~6--8 select the fonts: |Old Standard| is the default
4976 % font to be used for Roman shape (l.~6); the same font is used for
4977 % Greek, with some additional Open Type features enabled; finally,
4978 % the |Amiri| font is used for Arabic.
4979 % \item Lines~10--11 define so-called \enquote{tags} for easier access
4980 % to ancient Greek through \cs{begin}|{ancient|\allowbreak|greek}|
4981 % \dots\ \cs{end}|{ancientgreek}| for running paragraphs and
4982 % \cs{textancientgreek}\marg{text} for short insertions of Greek in
4983 % English text. \cs{sg}\marg{text} is just a shorthand for this
4984 % latter command.
4985 % \item Finally, lines~13--14 define simple language switching
4986 % commands for Arabic. As can be seen, no commands other than the
4987 % \LuaTeX\ primitives \cs{pardir} and \cs{textdir} have been used
4988 % for \pkg{babel} already takes care of selecting the Arabic
4989 % font. \cs{RL} is for short insertions of Arabic words in English
4990 % paragraphs while \cs{begin}|{Arabic}| \dots\ \cs{end}|{Arabic}| is
4991 % for running paragraphs of Arabic text.
4992 % \end{remarks}
4993 %
4994 % \paragraph{Changing the Writing Direction}
4995 % \DescribeMacro{\setRL} \DescribeMacro{\setLR} \cs{setRL} and
4996 % \cs{setLR} are two argument-less commands provided by \pkg{ekdosis}
4997 % that can be used to change the writing direction of running
4998 % paragraphs. The former sets the direction from right to left and the
4999 % latter form left to right. If \pkg{babel} be set as above,
5000 % \cs{setRL} \dots\ \cs{setLR} can be used in place of
5001 % \cs{begin}|{Arabic}| \dots\ \cs{end}|{Arabic}|.
5002 %
5003 % \paragraph{\pkg{polyglossia} Associated With \cs{babelprovide}}
5004 % What follows illustrates how \pkg{babel} can be used conjointly with
5005 % \pkg{polyglossia} for the same three languages as above without
5006 % having to load \pkg{luabidi}:---
5007 %
5008 % \captof{Multilingual editions with \pkg{babel} and
5009 % \pkg{polyglossia}}
5010 % \iffalse
5011 %<*example>
5012 % \fi
5013 \begin{minted}{latex}
5014 \usepackage{fontspec}
5015
5016 \usepackage{babel}
5017 \babelprovide[onchar=fonts]{arabic}
5018
5019 \setmainfont{Old Standard}
5020 \newfontfamily\greekfont{Old Standard}[RawFeature={+ss05;+ss06}]
5021 \babelfont[*arabic]{rm}{Amiri}
5022
5023 \usepackage{polyglossia}
5024 \setdefaultlanguage{english}
5025 \setotherlanguage[variant=ancient]{greek}
5026
5027 \newcommand{\textarabic}[1]{\bgroup\textdir TRT#1\egroup}
5028 \newenvironment{Arabic}{\par\pardir TRT\textdir TRT}{\par}
5029 \end{minted}
5030 % \iffalse
5031 %</example>
5032 % \fi
5033 %
5034 % \begin{remarks}
5035 % \item Line~3 just loads \pkg{babel} with no default language.
5036 % \item Lines~4 and 8 are used to have the Arabic font automatically
5037 % selected as above.
5038 % \item Lines~14--15 define the exact language switching commands that
5039 % would have been defined if \pkg{polyglossia} and \pkg{luabidi} had
5040 % been used for Arabic.
5041 % \end{remarks}
5042 %
5043 % As one can see, the important points about languages written from
5044 % right to left are to use \pkg{babel} only to select the Arabic
5045 % fonts, avoid using the bidirectional mechanism it provides and
5046 % define commands and environments that use only \LuaTeX\ primitives
5047 % to set the writing direction. Then, an Arabic edition text\---to
5048 % continue with this example\---can be entered as plainly as
5049 % follows:---
5050 %
5051 % \iffalse
5052 %<*example>
5053 % \fi
5054 \begin{minted}[linenos=false,escapeinside=++]{latex}
5055 \begin{ekdosis}
5056 \begin{Arabic}
5057 +\txarb{إِنَّ أَبِي كَانَ مِنَ}+ \app{
5058 \lem{+\txarb{ٱلْمُقَاتِلَةِ}+}
5059 \rdg{+\txarb{ٱلْمُقَاتِلِينَ}+}
5060 } +\txarb{وَ كَانَتْ أُمِّي مِنْ عُظَمَآءِ بُيُوتِ ٱلزَّمَازِمَةِ۔}+
5061 \end{Arabic}
5062 \end{ekdosis}
5063 \end{minted}
5064 % \iffalse
5065 %</example>
5066 % \fi
5067 %
5068 % It should be reminded that the writing direction of the apparatus
5069 % criticus itself is independent of that of the edition text and must
5070 % be set either with \cs{Set(LTR{\textbar}RTL)app} or with the
5071 % |direction| optional argument of \cs{SetApparatus} for single-layer
5072 % apparatus criticus, or by means of \cs{DeclareApparatus} for
5073 % multiple-layer apparatus criticus.\footnote{See above
5074 % \vref{sec:single-layer-app} (single-layer apparatus criticus) and
5075 % \vref{sec:multilayer-apparatus} (multiple-layer apparatus
5076 % criticus).}
5077 %
5078 % The PDF output with left-to-right apparatus criticus follows:---
5079 % \medskip
5080 %
5081 % \needspace{7\baselineskip}
5082 % \resetlinenumber
5083 % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
5084 % \begin{specimen}
5085 % \begin{arab}[fullvoc]
5086 % 'inna 'abI kAna mina \app[type=ltr]{
5087 % \lem{'l-muqAtilaTi}
5088 % \rdg{'l-muqAtilIna}}
5089 % wa-kAnat 'ummI min `u.zamA'i buyUti 'l-zamAzimaTi.
5090 % \end{arab}
5091 % \end{specimen}
5092 % \end{alignment}
5093 %
5094 % \needspace{5\baselineskip}
5095 % And here follows the PDF output with right-to-left apparatus
5096 % criticus:---
5097 % \medskip
5098 %
5099 % \needspace{7\baselineskip}
5100 % \resetlinenumber
5101 % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
5102 % \begin{specimen}
5103 % \begin{arab}[fullvoc]
5104 % 'inna 'abI kAna mina \app[type=rtl]{
5105 % \lem{'l-muqAtilaTi}
5106 % \rdg{'l-muqAtilIna}}
5107 % wa-kAnat 'ummI min `u.zamA'i buyUti 'l-zamAzimaTi.
5108 % \end{arab}
5109 % \end{specimen}
5110 % \end{alignment}
5111 %
5112 % \subsection{Using \pkg{arabluatex}}
5113 % \label{sec:using-arabluatex}
5114 % \pkg{arabluatex} is a \hologo{LuaLaTeX} package that provides
5115 % commands and environments which return Arabic writing from an ASCII
5116 % transliteration (either Arab\TeX\ or Buckwalter
5117 % scheme).\footcite{arabluatex} It is particularly well-suited for
5118 % complex documents such as critical editions where a lot of commands
5119 % intertwine with Arabic writing. \pkg{arabluatex} can output Unicode
5120 % Arabic in the same modes as \pkg{arabtex}\footcite{arabtex} or in
5121 % different accepted standards of romanization. It is also able to
5122 % produce a duplicate of the original |.tex| source file in which all
5123 % |arabtex| or |buckwalter| strings are replaced with Unicode
5124 % equivalents, either in Arabic script or in any accepted standard of
5125 % transliteration.\footcite[\mkbibquote{Exporting Unicode Arabic
5126 % to an External File}]{arabluatex}
5127 %
5128 % \pkg{arabluatex} is fully supported by \pkg{ekdosis}. The following
5129 % example illustrates how \pkg{arabluatex} and \pkg{ekdosis} interact
5130 % with each other to produce distinct \texttt{TEI xml} outputs from a
5131 % single |.tex| source file:---
5132 %
5133 % \captof{\pkg{ekdosis} and \pkg{arabluatex}}[\label{lst:arabluatex-ekd}]
5134 % \iffalse
5135 %<*example>
5136 % \fi
5137 \begin{minted}{latex}
5138 % Preamble:
5139 % load ekdosis and ask for TEI xml output:
5140 \usepackage[teiexport]{ekdosis}
5141 % load arabluatex and request a LaTeX output with Unicode Arabic:
5142 \usepackage[export,fullvoc]{arabluatex}
5143
5144 % document:
5145 \begin{arabexport} % export arabtex strings to Unicode Arabic
5146 \begin{ekdosis}
5147 \begin{arab}
5148 'inna 'abI kAna mina
5149 \app{
5150 \lem{'l-muqAtilaTi}
5151 \rdg{'l-muqAtilIna}
5152 }
5153 wa-kAnat 'ummI min `u.zamA'i buyUti 'l-zamAzimaTi.
5154 \end{arab}
5155 \end{ekdosis}
5156 \end{arabexport}
5157 \end{minted}
5158 % \iffalse
5159 %</example>
5160 % \fi
5161 %
5162 % The PDF output with left-to-right apparatus criticus is of course
5163 % the same as above:---
5164 % \medskip
5165 %
5166 % \needspace{7\baselineskip}
5167 % \resetlinenumber
5168 % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
5169 % \begin{specimen}
5170 % \begin{arab}[fullvoc]
5171 % 'inna 'abI kAna mina \app[type=ltr]{
5172 % \lem{'l-muqAtilaTi}
5173 % \rdg{'l-muqAtilIna}}
5174 % wa-kAnat 'ummI min `u.zamA'i buyUti 'l-zamAzimaTi.
5175 % \end{arab}
5176 % \end{specimen}
5177 % \end{alignment}
5178 %
5179 % However, assuming that the source file is called |source.tex|,
5180 % \pkg{ekdosis} produces as instructed from this file an additional
5181 % |source-tei.xml| as follows:---
5182 %
5183 % \iffalse
5184 %<*example>
5185 % \fi
5186 \begin{minted}[linenos=false]{xml}
5187 <p xml:lang="ar-Latn" type="transliterated"
5188 subtype="arabtex">'inna 'abI kAna mina
5189 <app>
5190 <lem>'l-muqAtilaTi</lem>
5191 <rdg>'l-muqAtilIna</rdg>
5192 </app>wa-kAnat 'ummI min `u.zamA'i buyUti
5193 'l-zamAzimaTi.</p>
5194 \end{minted}
5195 % \iffalse
5196 %</example>
5197 % \fi
5198 %
5199 % At the same time, \pkg{arabluatex} is instructed to produce on its
5200 % own from the same |source.tex| an additional |source_out.tex| in
5201 % which all |arabtex| strings found within \cs{begin}|{arabexport}|
5202 % \dots\ \cs{end}|{arabexport}| (see \vref{lst:arabluatex-ekd},
5203 % ll.~9--19) are replaced with full-vocalized Arabic Unicode
5204 % script. Finally, compiling this latter file produces the following
5205 % |sample-arabic_out-tei.xml| an extract of which follows:---
5206 %
5207 % \iffalse
5208 %<*example>
5209 % \fi
5210 \begin{minted}[linenos=false,escapeinside=++]{xml}
5211 <p xml:lang="arb">+\txarb{إِنَّ أَبِي كَانَ مِنَ}+
5212 <app>
5213 <lem>+\txarb{ٱلْمُقَاتِلَةِ}+</lem>
5214 <rdg>+\txarb{ٱلْمُقَاتِلِينَ}+</rdg>
5215 </app>+\txarb{وَكَانَتْ أُمِّي مِنْ عُظَمَآءِ بُيُوتِ}+
5216 +\txarb{ٱلزَّمَازِمَةِ.}+</p>
5217 \end{minted}
5218 % \iffalse
5219 %</example>
5220 % \fi
5221 %
5222 % The reader will find the full |arabic-sample.tex| source file with
5223 % instructions in \vref{sec:arabic-sample}, and is invited to refer to
5224 % the documentation of the \pkg{arabluatex} package for more
5225 % information on the way to use its Arabic environments and built-in
5226 % functions dedicated to export |arabtex| ASCII strings to
5227 % Unicode.\footcite{arabluatex}
5228 %
5229 % \section{Divisions of the Body}
5230 % \label{sec:body-divisions}
5231 % The features that are described in this section call for one general
5232 % remark. \pkg{ekdosis} is designed to figure out where any \LaTeX\
5233 % command that is converted to a \texttt{TEI} opening element allowed
5234 % to nest recursively, such as |<div>|, |<lg>| and the like, is to be
5235 % closed, even though there is no explicit indication of the point
5236 % where the closure occurs. Thoroughly scanning \LaTeX\ source files
5237 % with \textsf{Lua} functions which involve complex string matching
5238 % and recursions was required, as \LaTeX\ \enquote*{open} commands
5239 % such as \cs{chapter} or \cs{section} only act as milestones,
5240 % contrary to \texttt{TEI} elements.
5241 %
5242 % \danger It must be noted that the two styles described hereinafter
5243 % are mutually exclusive. \texttt{TEI xml} forbids that both be
5244 % combined within a single |<body>| element.\footnote{See
5245 % \url{https://tei-c.org/release/doc/tei-p5-doc/en/html/DS.html\#DSDIV}.}
5246 % As a result, \pkg{ekdosis} will disregard whichever one is not
5247 % selected.
5248 % \vskip\baselineskip
5249 %
5250 % \subsection{\LaTeX\ Standard Divisions}
5251 % \label{sec:latex-divs}
5252 % \pkg{ekdosis} can use the \LaTeX\ standard textual divisions, such
5253 % as \cs{book}, \cs{chapter}, \cs{section} and the like.
5254 %
5255 % \danger However, to have these divisions properly translated into
5256 % \texttt{TEI} numbered |<div>| elements, the |divs| general option
5257 % must be set to |latex| explicitly\---viz. |divs=latex|\---as
5258 % described above \vpageref{ref:divs-opt}.
5259 %
5260 % \danger As the \env{alignment} environment that is provided by
5261 % \pkg{ekdosis} places all aligned texts within \texttt{TEI xml}
5262 % un-numbered |<div>| elements and \LaTeX\ textual divisions are
5263 % converted into numbered |<div|\textsubscript{\emph{n}}|>| elements,
5264 % inserting such divisions in texts to be aligned will result in an
5265 % invalid \texttt{TEI xml} output. Instead, un-numbered divisions
5266 % through \cs{ekddiv} must be used as described below in
5267 % \vref{sec:ekddiv}.
5268 %
5269 % Once |divs| has been set to |latex|, \pkg{ekdosis} converts
5270 % \cs{book}, \cs{part}, \cs{chapter}, \cs{section}, \cs{subsection}
5271 % and \cs{subsubsection} into corresponding \texttt{TEI}
5272 % \enquote*{numbered} |<div|\textsubscript{\emph{n}}|>| elements,
5273 % where $1\leq n\leq 6$.
5274 %
5275 % \paragraph{Adjusting the Levels of Textual Subdivisions}
5276 % \DescribeMacro{\MkBodyDivs}
5277 % \cs{MkBodyDivs}\marg{div1}\marg{div2}\marg{div3}\allowbreak\marg{div4}\marg{div5}\marg{div6}
5278 % takes six mandatory arguments. This command can be used in the
5279 % preamble or at any point of the document to make the number of the
5280 % first-level subdivision of the edition text, viz.\ |<div1>|, match
5281 % to any \LaTeX\ command other than \cs{book}. For example, if
5282 % \cs{section} be the highest-level sectional command used, then
5283 % \cs{MkBodyDivs}|{section}{subsection}{subsubsection}{}{}|\allowbreak|{}|
5284 % will have \cs{section}, \cs{subsection} and \cs{subsubsection}
5285 % converted into |<div1>|, |<div2>| and |<div3>| respectively.
5286 %
5287 % \paragraph{Inserting Variants in Headings}
5288 % Variant readings can be inserted in headings. In this case, the
5289 % optional argument of the \LaTeX\ sectional command must naturally be
5290 % used to prevent variants from going into headers, footers or the
5291 % table of contents, like so:\footnote{On the use of \texttt{egomute}
5292 % (l.~13), see above \vref{it:egomute}.}---
5293 %
5294 % \iffalse
5295 %<*example>
5296 % \fi
5297 \begin{minted}{latex}
5298 % Preamble:
5299 \usepackage[teiexport=tidy, divs=latex]{ekdosis}
5300 \MkBodyDivs{chapter}{section}{}{}{}{}
5301
5302 % Document:
5303 \chapter[Ἱπποκράτους ἐπιδημιῶν βιβλίον δεύτερον]{Ἱπποκράτους ἐπιδημιῶν
5304 \app{
5305 \lem[wit={I,R,H}]{βιβλίον δεύτερον}
5306 \rdg[wit=V]{λόγος β’}}}
5307
5308 \section[Τμῆμα πρῶτον]{
5309 \app{
5310 \lem[resp=egomute, type=emendation, nosep,
5311 post=suppleui]{\supplied{Τμῆμα πρῶτον}}
5312 }}
5313 Ἄνθρακες θερινοὶ ἐν Κραννῶνι· [...]
5314 \end{minted}
5315 % \iffalse
5316 %</example>
5317 % \fi
5318 %
5319 % \texttt{TEI xml} output:---
5320 %
5321 % \iffalse
5322 %<*example>
5323 % \fi
5324 \begin{minted}[linenos=false]{xml}
5325 <div1 type="chapter">
5326 <head>Ἱπποκράτους ἐπιδημιῶν
5327 <app>
5328 <lem wit="#I #R #H">βιβλίον δεύτερον</lem>
5329 <rdg wit="#V">λόγος β’</rdg>
5330 </app></head>
5331 <div2 type="section">
5332 <head>
5333 <app>
5334 <lem><supplied resp="#ego" type="emendation">Τμῆμα
5335 πρῶτον</supplied></lem>
5336 </app>
5337 </head>
5338 <p>Ἄνθρακες θερινοὶ ἐν Κραννῶνι· [...]</p>
5339 </div2>
5340 </div1>
5341 \end{minted}
5342 % \iffalse
5343 %</example>
5344 % \fi
5345 %
5346 % \subsection{\texttt{TEI} Un-numbered Divisions}
5347 % \label{sec:ekddiv}
5348 % \danger As already described \vpageref{ref:divs-opt}, the
5349 % un-numbered style of division is the one that is set by default. It
5350 % is congruous to the general option |divs=ekdosis|.
5351 %
5352 % This style provides a flexible mechanism in which format and
5353 % presentation are separated from content. It is designed to meet the
5354 % requirements of classical and literary texts the divisions of which
5355 % may depend on many different received traditions.
5356 %
5357 % \DescribeMacro{\ekddiv} \cs{ekddiv}\marg{key-value arguments} is the
5358 % unique sectional command provided by \pkg{ekdosis}. This command
5359 % converts the divisions into un-numbered \texttt{TEI} |<div>|
5360 % elements allowed to nest recursively and takes one mandatory
5361 % argument in which the following |key-value| arguments are
5362 % accepted:---\\
5363 % \DescribeOption{type} |type|$=$\meta{name}
5364 % \hfill\tcboxverb{Default: none}\\
5365 % |type| corresponds to the \texttt{TEI} class |att.typed| and can be
5366 % used to classify the element in which it is found in any
5367 % way. Suitable values here can be |book|, |chapter|, |section| and
5368 % the like.\\
5369 % \DescribeOption{n} |n|$=$\meta{value} \hfill
5370 % \tcboxverb{Default: none}\\
5371 % |n| is meant to provide a number or any kind of label for the
5372 % division and does not have to be unique in the document.\\
5373 % \DescribeOption{head} |head|$=$\meta{name}
5374 % \hfill\tcboxverb{Default: none}\\
5375 % |head| holds the title of the division and may further contain
5376 % variant readings.\\
5377 % \DescribeOption{barehead} |barehead|$=$\meta{name}
5378 % \hfill\tcboxverb{Default: none}\\
5379 % |barehead| is supposed to be used to prevent unwanted commands from
5380 % going into such places as headers, footers and the table of
5381 % contents.\\
5382 % \DescribeOption{depth} |depth|$=$\meta{n} where $1\leq n\leq 9$
5383 % \hfill\tcboxverb{Default: 1}\\
5384 % As \texttt{TEI} un-numbered divisions are simply |<div>| elements
5385 % allowed to nest recursively to indicate their hierarchic depth and
5386 % \cs{ekddiv} is an \enquote*{open} \LaTeX\ command, |n| is needed to
5387 % indicate the depth of the division within the hierarchy, the largest
5388 % being |1| and the smallest being |9|.\\
5389 % \DescribeOption{toc}
5390 % |toc|$=$\verb+book|part|chapter|section|subsection|subsubsection|paragraph|+\\
5391 % \phantom{|toc|$=$}|subparagraph|\hfill\tcboxverb{Default: not set}\\
5392 % If |toc| be set, the title of the division goes into the table of
5393 % contents at the hierarchic level that is specified as value.\\
5394 % \DescribeOption{mark} \newfeature[v1.3] |mark|$=$\meta{signpost}
5395 % \hfill\tcboxverb{Default: none}\\
5396 % |mark| holds the signpost to be emitted as marker for headers and
5397 % footers. Its value is recalled by \cs{ekdmark} as described below in
5398 % \vref{sec:headers-footers}.
5399 %
5400 % \paragraph{Formatting the Titles}
5401 % \DescribeMacro{\FormatDiv} By design, \pkg{ekdosis} does
5402 % not format the titles. Instead, depending on what is needed for the
5403 % edition text, \cs{FormatDiv}\marg{n}\marg{code
5404 % before}\marg{code after} is provided to lay out the titles of any
5405 % hierarchic depth of division. This command takes three mandatory
5406 % arguments as follows: \meta{n}, which is the number referring to the
5407 % particular depth of division to be formatted and some \LaTeX\
5408 % commands to go before and after the title itself. The following
5409 % example illustrates how the titles of the largest division can be
5410 % printed horizontally centered in a larger size:---
5411 %
5412 % \iffalse
5413 %<*example>
5414 % \fi
5415 \begin{minted}[linenos=false]{latex}
5416 \FormatDiv{1}{\begin{center}\Large}{\end{center}}
5417 \end{minted}
5418 % \iffalse
5419 %</example>
5420 % \fi
5421 %
5422 % To elaborate on the example provided above in \vref{sec:latex-divs},
5423 % here follows how the first three hierarchical levels could be
5424 % formatted as un-numbered divisions:---
5425 %
5426 % \captof{Divisions of the body text}[\label{lst:ekddiv-ex}]
5427 % \iffalse
5428 %<*example>
5429 % \fi
5430 \begin{minted}{latex}
5431 % Preamble:
5432 \FormatDiv{1}{\begin{center}\Large}{\end{center}}
5433 \FormatDiv{2}{\begin{center}\large}{\end{center}}
5434 \FormatDiv{3}{\bfseries}{.}
5435
5436 % Document:
5437 \begin{ekdosis}
5438 \ekddiv{
5439 head={Ἱπποκράτους ἐπιδημιῶν
5440 \app{
5441 \lem[wit={I,R,H}]{βιβλίον δεύτερον}
5442 \rdg[wit=V]{λόγος β’}}},
5443 type=book,
5444 depth=1,
5445 n=II
5446 }
5447
5448 \ekddiv{
5449 head={\app{
5450 \lem[resp=egomute, post=suppleui,
5451 type=emendation]{\supplied{Τμῆμα πρῶτον}}
5452 \rdg[wit=codd, alt=om.]{}}},
5453 type=section,
5454 depth=2,
5455 n=II.1
5456 }
5457
5458 \ekddiv{head=1, type=paragraph, depth=3, n=II.1.1}
5459 Ἄνθρακες θερινοὶ ἐν Κραννῶνι· [...]
5460 \end{ekdosis}
5461 \end{minted}
5462 % \iffalse
5463 %</example>
5464 % \fi
5465 %
5466 % PDF output:---
5467 % \medskip
5468 %
5469 % \begingroup
5470 % \needspace{7\baselineskip}
5471 % \resetlinenumber
5472 % \FormatDiv{1}{\begin{center}\Large}{\end{center}}
5473 % \FormatDiv{2}{\begin{center}\large}{\end{center}}
5474 % \FormatDiv{3}{\bfseries}{.}
5475 % \begin{alignment}[flush,
5476 % tcols=1,
5477 % texts=hippocrates[xml:lang="grc"],
5478 % apparatus=hippocrates]
5479 % \AtBeginEnvironment{hippocrates}{\selectlanguage{greek}}
5480 % \begin{hippocrates}
5481 % \ekddiv{
5482 % head={Ἱπποκράτους ἐπιδημιῶν
5483 % \app{
5484 % \lem[wit={hI,hR,hH}]{βιβλίον δεύτερον}
5485 % \rdg[wit=hV]{λόγος β’}}},
5486 % type=book,
5487 % depth=1,
5488 % n=II}
5489 %
5490 % \ekddiv{
5491 % head={\app{
5492 % \lem[resp=egomute, post=suppleui,
5493 % type=emendation]{\supplied{Τμῆμα πρῶτον}}
5494 % \rdg[wit=hcodd, alt=om.]{}}},
5495 % type=section,
5496 % depth=2,
5497 % n=II.1
5498 % }
5499 %
5500 % \ekddiv{head=1, type=paragraph, depth=3, n=II.1.1} Ἄνθρακες
5501 % θερινοὶ ἐν Κραννῶνι· [...]
5502 % \end{hippocrates}
5503 % \end{alignment}
5504 % \endgroup
5505 %
5506 % \texttt{TEI xml} output:---
5507 %
5508 % \iffalse
5509 %<*example>
5510 % \fi
5511 \begin{minted}[linenos=false]{xml}
5512 <div xml:id="div-hippocrates_1" xml:lang="grc">
5513 <div type="book" n="II">
5514 <head>Ἱπποκράτους ἐπιδημιῶν
5515 <app>
5516 <lem wit="#I #R #H">βιβλίον δεύτερον</lem>
5517 <rdg wit="#V">λόγος β’</rdg>
5518 </app></head>
5519 <div type="section" n="II.1">
5520 <head>
5521 <app>
5522 <lem resp="#ego" type="emendation">
5523 <supplied>Τμῆμα πρῶτον</supplied>
5524 </lem>
5525 <rdg wit="#V #I #R #H" />
5526 </app>
5527 </head>
5528 <div type="paragraph" n="II.1.1">
5529 <head>1</head>
5530 <p>Ἄνθρακες θερινοὶ ἐν Κραννῶνι· [...]</p>
5531 </div>
5532 </div>
5533 </div>
5534 </div>
5535 \end{minted}
5536 % \iffalse
5537 %</example>
5538 % \fi
5539 %
5540 % \subsection{Headers and Footers}
5541 % \label{sec:headers-footers}
5542 % \newfeature[v1.3] \pkg{ekdosis} provides a mechanism of its own for
5543 % emitting header and footer marks. The first operation consists in
5544 % recording the information to be printed as signpost by means of the
5545 % |mark| optional argument of the \cs{ekddiv} command described above
5546 % in \vref{sec:ekddiv}.
5547 %
5548 % \DescribeMacro{\ekdmark} Once this is done, \cs{ekdmark} can be
5549 % inserted in commands used to make headers and footers where the mark
5550 % is to be printed.
5551 %
5552 % A common layout is that of headers in which one finds printed in
5553 % sequence on even pages the page number, then the author's name, and
5554 % on odd pages the title of the edited text, then the current
5555 % division, then the page number, like so:---
5556 %
5557 % \needspace{5\baselineskip}
5558 % \begin{xltabular}{1.0\linewidth}{|XcX|}
5559 % \multicolumn{3}{l}{Even pages:}\\
5560 % \hline
5561 % \cs{thepage} & Hippocratis & \\
5562 % \hline
5563 % \multicolumn{3}{l}{Odd pages:}\\
5564 % \hline
5565 % & Epidemiarum liber II, \cs{ekdmark} & \hfill\cs{thepage}\\
5566 % \hline
5567 % \end{xltabular}
5568 %
5569 % To return to the example provided by \vref{lst:ekddiv-ex}, the mark
5570 % of the current division would be inserted in the third-level
5571 % \cs{ekddiv} command printed at line~28 like so:---
5572 %
5573 % \iffalse
5574 %<*example>
5575 % \fi
5576 \begin{minted}[firstnumber=28,linenos]{latex}
5577 \ekddiv{head=1, type=paragraph, depth=3, n=II.1.1, mark={1, 1}}
5578 \end{minted}
5579 % \iffalse
5580 %</example>
5581 % \fi
5582 %
5583 % The following example finally illustrates how the corresponding
5584 % headers and footers can be prepared in a straightforward way with
5585 % the help of the \pkg{titleps} package:\footcite{titleps}---
5586 %
5587 % \iffalse
5588 %<*example>
5589 % \fi
5590 \begin{minted}[linenos=false]{latex}
5591 % Preamble:
5592 \usepackage{titleps}
5593 \newpagestyle{edition}{
5594 \sethead[\thepage][Hippocratis][]
5595 {}{Epidemiarum liber II, \ekdmark}{\thepage}
5596 }
5597 % Apply the page style:
5598 \pagestyle{edition}
5599 \end{minted}
5600 % \iffalse
5601 %</example>
5602 % \fi
5603 %
5604 % \DescribeMacro{\endmark} It must be noted that \cs{ekdmark} is
5605 % designed to print the first mark that is emitted on a given page and
5606 % ignore the mark corresponding to any portion of text that may be
5607 % printed between the top of the page and the point where the first
5608 % mark is called. \cs{endmark} is an argument-less command that can be
5609 % used just at the end of that portion of text to instruct
5610 % \pkg{ekdosis} to print the last-emitted mark of the preceding page
5611 % instead of the first-emitted mark of the current page.
5612 %
5613 % \paragraph{Removing Headers and Footers}
5614 % Pages such as title pages must be printed with empty headers and
5615 % footers. \pkg{ekdosis} must be given control over every item of
5616 % information inserted in these areas beforehand.
5617 %
5618 % \DescribeMacro{\ekdprintmark}
5619 % \cs{ekdprintmark}\marg{selector}\marg{signpost} The signposts
5620 % printed in headers and footers must be passed as second argument of
5621 % \cs{ekdprintmark} so that \pkg{ekdosis} can remove them on pages
5622 % where printing them is not desirable. \meta{selector} refers to
5623 % three symbolic letters where the first can be either |H| or
5624 % |F|\===for \underLine{h}eader or \underLine{f}ooter\===, the second
5625 % |E| or |O|\===for \underLine{o}dd or \underLine{e}ven\===and the
5626 % third |L|, |C| or |R|\===for \underLine{l}eft, \underLine{c}enter or
5627 % \underLine{r}ight. The example provided above would then read as
5628 % follows:---
5629 %
5630 % \iffalse
5631 %<*example>
5632 % \fi
5633 \begin{minted}[linenos=false]{latex}
5634 % Preamble:
5635 \usepackage{titleps}
5636 \newpagestyle{edition}{
5637 \sethead[\ekdprintmark{HEL}{\thepage}]
5638 [\ekdprintmark{HEC}{Hippocratis}]
5639 []
5640 {}
5641 {\ekdprintmark{HOC}{Epidemiarum liber II, \ekdmark}}
5642 {\ekdprintmark{HOR}{\thepage}}
5643 }
5644 % Apply the page style:
5645 \pagestyle{edition}
5646 \end{minted}
5647 % \iffalse
5648 %</example>
5649 % \fi
5650 %
5651 % \DescribeMacro{\ekdnohfmarks} Once all signposts are marked with
5652 % \cs{ekdprintmark}, \cs{ekdnohfmarks} can be used at any point of the
5653 % document with the same effect as the \LaTeX\ standard command
5654 % \cs{thispagestyle}|{empty}|.
5655 %
5656 % \DescribeMacro{\ekdresethfmarks} Finally, \cs{ekdresethfmarks} is
5657 % provided in rare cases when it is needed to reset headers and
5658 % footers to their original, viz.\ printable state.
5659 %
5660 % \section{The Tricks of the Trade}
5661 % \label{sec:tricks-of-trade}
5662 % As the |.tex| source file is compiled, \pkg{ekdosis} has to compute
5663 % a tremendous amount of data. Most of this work is performed by
5664 % \textsf{Lua} functions. An edition text narrowed down to a single
5665 % page needs to be compiled at least three times. On the first run,
5666 % the apparatus criticus does not show. Instead, \pkg{ekdosis}
5667 % produces an auxiliary file named \cs{jobname}|.ekd| in which all the
5668 % entries of the apparatus criticus are collected. Then, on the second
5669 % run a test is performed on this auxiliary file to determine whether
5670 % there are entries\---and if so, which ones\---to be printed on the
5671 % current page. At the same time, references to the line numbers are
5672 % updated if necessary. Finally, on the third run, the apparatus
5673 % criticus is printed.
5674 %
5675 % Of course, every change made to the input may similarly require
5676 % \hologo{LuaLaTeX} to be run three more times to get everything to
5677 % the right place with the right numbers.
5678 %
5679 % \subsection{The Oscillating Problem}
5680 % \label{sec:oscillating-problem}
5681 % In some instances, notably when on a given page entries are very
5682 % abundant in number, specifically when the edition text is getting
5683 % close to the bottom of the page, \pkg{ekdosis} may oscillate
5684 % indefinitely between different sets of page decisions without being
5685 % able to settle down. The condition may be typically illustrated as
5686 % follows: after Lua\LaTeX\ has been run, an entry is attached to the
5687 % last line of the page. As said above, this entry does not show
5688 % yet. But when it does, should it result in an additional line being
5689 % printed in the apparatus criticus, the last line of the edition
5690 % text\---the one the entry was previously attached to\---goes to the
5691 % next page. As a result, this entry also moves to the next page with
5692 % the line it belongs to. This point is literally critical, because
5693 % unless a \cs{pagebreak} is inserted just here so as to keep the
5694 % contentious line on the next page, \pkg{ekdosis} enters a vicious
5695 % circle from which it cannot escape, not to mention that right
5696 % entries with right line numbers cannot come on pages that follow a
5697 % wrong page either.
5698 %
5699 % An alert reader may have guessed that inserting a \cs{pagebreak} is
5700 % a good way to get out of the vicious circle. And surely, if only a
5701 % few pages be at stake, this is the way to go. However,
5702 % \cs{pagebreak} commands should only be inserted when the whole
5703 % edition text is ready for any substantial change in the preceding
5704 % pages may result in pages that break just after they begin.
5705 %
5706 % \paragraph{Conditional page breaks}
5707 % \phts\label{ref:ekdpb} \DescribeMacro{\ekdpb}\DescribeMacro{\ekdpb*}
5708 % \cs{ekdpb}\oarg{page no}\marg{line no}
5709 % \cs{ekdpb*}|{}| \cs{ekdpb*}|\|
5710 % \newfeature[v1.2]\\
5711 % One way to avoid this inconvenience is to use \cs{ekdpb} instead of
5712 % the standard \cs{pagebreak} command provided by \LaTeX\ to insert
5713 % conditional page breaks. \cs{ekdpb} takes as mandatory argument the
5714 % line number, as it is printed in the margin, where the page break
5715 % should take place. An optional argument allows to further specify
5716 % the page number where the page break should occur. The value that is
5717 % expected is the page number as it is printed\===e.g.\ an Arabic,
5718 % Roman or alphanumeric number. If the specified conditions be not
5719 % met, then the page break is not triggered. Finally, the
5720 % \enquote{starred} version of this command forces the page break,
5721 % irrespective of the values specified as page or line numbers. Unlike
5722 % \cs{ekdpb}, which requires the lines to be numbered, \cs{ekdpb*} is
5723 % allowed at any point of the document: as \cs{ekdpb*} disregards the
5724 % number given as argument, it is equivalent to the standard \LaTeX\
5725 % \cs{pagebreak} command. Yet it can be used instead of the latter to
5726 % have marks further printed in the margins so as to spot with a
5727 % fleeting glance the locations where induced page breaks
5728 % occur.\footnote{This requires the |showpagebreaks| option to be set
5729 % to |true| as described above \vpageref{ref:showpagebreaks-opt}.}
5730 %
5731 % \paragraph{Using \texttt{maxentries}}
5732 % Another way\---should the edition text fall into the vicious circle
5733 % too often\---is to limit the number of entries per page that a given
5734 % layer of apparatus criticus may accept as described above
5735 % \vpageref{ref:maxentries}. As a result, \pkg{ekdosis} will take care
5736 % of inserting automatic breakpoints between pages whenever the number
5737 % of entries on a given page reaches the value set as |maxentries|.
5738 %
5739 % |maxentries| must not be too small: otherwise offensive to look at
5740 % vertical spaces may come between the edition text and the apparatus
5741 % criticus. Conversely, |maxentries| must not be too big: otherwise,
5742 % should entries overflow on a given page, the edition text and the
5743 % apparatus criticus may clash again. As said above, a couple of
5744 % clashes can be managed with a couple of manually inserted page
5745 % breaks. But if there be too many of them, it is a good indication
5746 % that the selected value of |maxentries| is too high.
5747 %
5748 % Complex edition texts do have a magic number. An advisable way to
5749 % figure it out would be to start from a sample of only a few pages,
5750 % selected as evidence for the complexity of the whole. As only a few
5751 % pages would need to be compiled, the magic number should emerge
5752 % quite rapidly.
5753 %
5754 % \paragraph{Adding and Removing Entries}
5755 % \DescribeMacro{\addentries} \cs{addentries}\oarg{layer}\marg{n}
5756 % \newfeature[v1.1]\\
5757 % If |maxentries| be set for a given layer of critical notes,
5758 % \cs{addentries}\oarg{layer}\marg{n}, where \meta{n} is an integer,
5759 % can be used to add \meta{n} to\---or remove it from if \meta{n} be
5760 % negative\---the number of accepted entries on the current
5761 % page. \cs{addentries} operates on the default layer of notes, but
5762 % any other declared layer can be specified in the optional argument
5763 % of the command.
5764 %
5765 % \danger Of course, \cs{addentries} must be issued before the
5766 % number of entries on a given page has reached the value set as
5767 % |maxentries|.
5768 %
5769 % Once a sensible value for |maxentries| has been found,
5770 % \cs{addentries} can further be used with a positive integer to allow
5771 % for more entries and more lines on some pages so that offending
5772 % vertical spaces are decreased. Conversely, \cs{addentries} with a
5773 % negative integer will remove entries on pages where there are too
5774 % many of them and \pkg{ekdosis} still oscillates between different
5775 % sets of page decisions.
5776 %
5777 % \paragraph{The \texttt{fitapp} Global Option}
5778 % \newfeature[v1.3] The rationale of this option is discussed above
5779 % (see \vref{ref:fitapp-opt}). As this mechanism has the characters of
5780 % the apparatus block scaled down to allow for more entries once a
5781 % predefined height has been reached, \pkg{ekdosis} should settle down
5782 % in most of the contentious cases.\footnote{That is, cases that arise
5783 % \emph{after} the predefined height has been reached.} However, it is
5784 % advisable to use |fitapp| conjointly with |maxentries| to prevent
5785 % the number of allowed entries from being too high, which would
5786 % result in the characters being too small or even illegible.
5787 %
5788 % \subsection{Variae Quaestiones}
5789 % \label{sec:variae-quaestiones}
5790 % This section is about issues that are not strictly speaking part of
5791 % the documentation of \pkg{ekdosis} but may nevertheless
5792 % circumstantially arise.
5793 %
5794 % \paragraph{Superfluous Dots}
5795 % \phts\label{sec:superfluous-dots} As said above
5796 % \vpageref{ref:ending-dot}, it is customary in some editions to have
5797 % a full stop printed at the end of the apparatus
5798 % criticus. \pkg{ekdosis} provides specific commands to achieve this
5799 % in a straightforward way, such as \cs{SetEndApparatus} and the
5800 % |ehook| optional argument of \cs{SetApparatus} and
5801 % \cs{DeclareApparatus}.\footnote{See above
5802 % \vpagerefrange{ref:setendapparatus}{sec:declaring-layers}.} However,
5803 % if the last word of the apparatus criticus on a given page be an
5804 % abbreviation followed by a dot, such a setting will have two dots
5805 % printed at the end of the apparatus instead of one. The solution is
5806 % to define a command to have a dot printed only if not followed by a
5807 % dot, and append this command to the abbreviated form of the word,
5808 % like so:---
5809 %
5810 % \iffalse
5811 %<*example>
5812 % \fi
5813 \begin{minted}{latex}
5814 % Preamble:
5815 \usepackage{xspace}
5816 \usepackage{ekdosis}
5817
5818 \makeatletter
5819 \newcommand{\ekddot}{%
5820 \ltx@ifnextchar{.}{\xspace}{.\xspace}}
5821 \makeatother
5822
5823 \DeclareApparatus{default}[ehook=.]
5824 \DeclareScholar{Erm}{Erm\ekddot}
5825 \end{minted}
5826 % \iffalse
5827 %</example>
5828 % \fi
5829 %
5830 % \begin{remarks}
5831 % \item Line~2: The \pkg{xspace} package is needed for \cs{xspace} is
5832 % used by the \cs{ekddot} command that is defined at l.~6.
5833 % \item Line~7: \cs{ltx@ifnextchar} is part of the \pkg{ltxcmds}
5834 % package which is loaded by \pkg{ekdosis}. As this command uses a
5835 % private control sequence, it must be found within
5836 % \cs{makeatletter} \dots\ \cs{makeatother}.
5837 % \item Line~10: \cs{ekddot} will only work with multiple-layer
5838 % apparatus criticus. Therefore, \cs{DeclareAppa{\allowbreak}ratus}
5839 % must be used even if only one layer of critical notes be needed.
5840 % \end{remarks}
5841 %
5842 % \paragraph{Backup of Essential Files}
5843 % Each time the |.tex| source file is compiled, \pkg{ekdosis} reads
5844 % the |.aux| corresponding \LaTeX\ auxiliary file and its own |.ekd|
5845 % auxiliary file so as to process labels and collect entries of the
5846 % apparatus criticus. If for whatever reason\---e.g.\ some unknown
5847 % command has been inserted\---the compilation be frozen and so must
5848 % be aborted, it may happen that most of the edition text has to be
5849 % reconstructed page after page. For large and complex editions, this
5850 % makes advisable to have current versions of those files backed up
5851 % each time a new compilation begins, which can be achieved by
5852 % inserting the following lines before the line that loads the
5853 % document class:---
5854 %
5855 % \iffalse
5856 %<*example>
5857 % \fi
5858 \begin{minted}[linenos=false]{latex}
5859 \RequirePackage{verbatimcopy}
5860 \IfFileExists{\jobname.aux}{%
5861 \OldVerbatimCopy{\jobname.aux}{\jobname.aux.bak}}{}
5862 \IfFileExists{\jobname.ekd}{%
5863 \OldVerbatimCopy{\jobname.ekd}{\jobname.ekd.bak}}{}
5864 \documentclass{book}
5865 \end{minted}
5866 % \iffalse
5867 %</example>
5868 % \fi
5869 %
5870 % This way, both |.aux| and |.ekd| files can be recovered from
5871 % |.aux.bak| and |.ekd.bak| just after the compilation has been
5872 % aborted. Should this be needed, one must proceed carefully as
5873 % follows:---
5874 % \begin{enumerate}
5875 % \item Just after the compilation has been aborted, move both
5876 % |aux.bak| and |ekd.bak| files to a safe place.
5877 % \item Remove or correct the offending command or lines that broke
5878 % the compilation and make sure that the issue is solved.
5879 % \item Restore the |.aux| and |.ekd| files from |aux.bak| and
5880 % |.ekd.bak| and resume work where it was left off.
5881 % \end{enumerate}
5882 %
5883 % \section{\texttt{TEI xml} Output}
5884 % \label{sec:teixml-output}
5885 % Several examples of \texttt{TEI xml} output have been provided
5886 % hitherto. Before proceeding, the reader is invited to return to
5887 % every one of them. In this respect, it may be of interest to review
5888 % carefully the excerpt of Caesar's \emph{Gallic War} of which the
5889 % \LaTeX\ source file and its corresponding \texttt{TEI xml} output
5890 % are printed in full below in \vref{sec:caesar-gw-6-1-13}. Once
5891 % \pkg{ekdosis} has been instructed to convert the edition text into
5892 % \texttt{TEI xml} (l.~11), the preamble of this file shows how to set
5893 % languages and fonts to be used in the document (ll.~2--6), format
5894 % the titles (l.~16) and lay out the alignment of an edition text
5895 % associated with two translations (ll.~18--25) in modern
5896 % languages. Furthermore, it shows how information related to each
5897 % language (Latin, English and French) is to be found in two different
5898 % places, namely for \texttt{TEI xml} output (ll.~21--3) and for PDF
5899 % output through \LaTeX\ (ll.~27--9). Finally, it provides examples of
5900 % declaring witnesses, hands and shorthands (ll.~31--60). As to the
5901 % document itself, it shows how to lay out a conspectus siglorum in a
5902 % table (ll.~64--80), before giving detailed examples of how the
5903 % edition text is entered (ll.~85--101) and sectional commands
5904 % provided by \pkg{ekdosis} are used (ll.~86, 103 and
5905 % 110).\footnote{The PDF output is available as
5906 % \href{samples/Caesar_BG-6-13-1.pdf}{a separate file}.}
5907 %
5908 % \subsection{Requesting \texttt{TEI xml} Output}
5909 % \label{sec:request-tei-output}
5910 % \texttt{TEI xml} output is requested by means of the |teiexport|
5911 % global option as described above
5912 % \vpageref{ref:teiexport-option}. Once instructed to output
5913 % \texttt{TEI}, \pkg{ekdosis} converts and exports in sequence the
5914 % contents of \env{ekdosis} environments (see above
5915 % \vref{sec:single-text-editing}). As regards the contents of
5916 % \env{alignment} environments (see above \vref{sec:alignment-basic}),
5917 % \pkg{ekdosis} first collates the contents of the environments that
5918 % have been declared as values of the |texts| optional argument of
5919 % \env{alignment} or \cs{SetAlignment},\footnote{See above
5920 % \vref{sec:multiple-alignment}.} then places each of the
5921 % corresponding \texttt{TEI xml} outputs within distinct |<div>|
5922 % elements named after the declared environments themselves. For
5923 % example, to return to Caesar's text, the Latin edition text is found
5924 % between a \cs{begin}|{latin}| \dots\ \cs{end}|{latin}| environment
5925 % (see the |.tex| source file, \vref{sec:caesar-gw-tex}, ll.~85--101)
5926 % which is declared at l.~21. Then, the corresponding \texttt{xml}
5927 % output is found within a |<div>| element, the |xml:id| of which has
5928 % been given by \pkg{ekdosis} the value |div-latin_1| (see
5929 % \vref{sec:caesar-gw-tei}, ll.~176--200).
5930 %
5931 % \paragraph{\texttt{TEI} File Name} \DescribeMacro{\SetTEIFilename}
5932 % \cs{SetTEIFilename}\marg{basename} is a preamble-only command. It
5933 % can be used to set the base name of the \texttt{TEI xml} output
5934 % file, to which the suffix |.xml| is appended. By default, the base
5935 % name is \cs{jobname}|-tei|.
5936 %
5937 % \subsection{General Principles}
5938 % \label{sec:totei-general-principles}
5939 % \paragraph{Validation of the \texttt{TEI xml} Structure}
5940 % The reference tool that the author relies on is that provided by the
5941 % \emph{\texttt{TEI} by Example Project}.\footnote{\cite{TBE}.
5942 % The \texttt{TEI} validator is here:
5943 % \url{http://teibyexample.com/xquery/TBEvalidator.xq}.} As for
5944 % \pkg{ekdosis}, it is designed to produce on request, in addition to
5945 % an edition in print, a \texttt{TEI xml}-compliant output file. That
5946 % said, one must keep in mind that the \LaTeX\ packages that are part
5947 % of {\TeX}Live can be counted in thousands, and the commands they
5948 % provide in tens of thousands. There may even be grounds in asserting
5949 % that the possibilities offered by \TeX\ and \LaTeX\ quite exceed
5950 % what can be afforded by \texttt{TEI xml}. On another hand, many
5951 % \LaTeX\ commands make no sense in \texttt{TEI}. Therefore, a
5952 % sensible choice is to keep them out of the environments the contents
5953 % of which are to be translated into \texttt{xml} elements, as will be
5954 % illustrated by the following.
5955 %
5956 % Converting a \LaTeX\ document into \texttt{TEI xml} can be quite an
5957 % intricate business. In many cases, however, \LaTeX\ strings are
5958 % found within environments or groups that are easy to convert into
5959 % \texttt{TEI} equivalents: unless instructed otherwise, whether such
5960 % groups are delimited by opening and closing braces or by explicit
5961 % \cs{begin} \dots\ \cs{end} commands, \pkg{ekdosis} translates them
5962 % into |xml| so that for example \cs{emph}|{word}| and
5963 % \cs{begin}|{quote}| \meta{quoted words} \cs{end}|{quote}| become
5964 % |<emph>| \meta{word} |</emph>| and |<quote>| \meta{quoted words}
5965 % |</quote>| respectively.
5966 %
5967 % But \LaTeX\ does not place everything into groups or
5968 % environments. To take here but a few examples, sectional divisions
5969 % are marked in \LaTeX\ with \enquote{open} commands such as
5970 % \cs{chapter} or \cs{section} with no clear indication where the
5971 % closure of divisions occurs, contrary to \texttt{TEI xml} markup
5972 % with numbered or un-numbered |<div>| elements allowed to nest
5973 % recursively. As regards running paragraphs of text, the situation is
5974 % even worse than in the latter case, as the following simple example
5975 % shows:---
5976 %
5977 % \iffalse
5978 %<*example>
5979 % \fi
5980 \begin{minted}{latex}
5981 \begin{document}
5982 \begin{ekdosis}
5983 ...
5984
5985 ... These are the final words of some section in the body text.
5986
5987 \section{New Section}
5988
5989 Here is how some new section begins...
5990
5991 ... Final words.
5992 \section{Other Section}
5993 Opening words of the section...
5994
5995 ... Final words
5996
5997 \section{Other Section}
5998 Opening words...
5999
6000 ... Final words.
6001 \end{ekdosis}
6002 \end{document}
6003 \end{minted}
6004 % \iffalse
6005 %</example>
6006 % \fi
6007 %
6008 % Obviously, construing this \LaTeX\ source file into \texttt{TEI xml}
6009 % is a fairly complex task. For example, line~6 only closes a
6010 % paragraph for line~7 opens a division (hence |</p><div1>|), line~8
6011 % only opens a paragraph just after the heading of the section (hence
6012 % |</head><p>|) while line~14 both closes the foregoing paragraph and
6013 % opens a new one (hence |</p><p>|), contrary to line~16 which both
6014 % closes a paragraph and a sectional division (hence |</p></div1>|),
6015 % not to mention lines~20--1, where notwithstanding the absence of
6016 % blank line or any other indication,
6017 % |</p></div1></body></text></TEI>| is needed.
6018 %
6019 % \pkg{ekdosis} has been designed to implement this task through
6020 % \textsf{Lua} functions which involve string matching (both forward
6021 % and reverse matching) and recursions.
6022 %
6023 % \paragraph{\texttt{TEI xml} Export Settings}
6024 % \label{ref:setteixmlexport}
6025 % \DescribeMacro{\SetTEIxmlExport} \cs{SetTEIxmlExport}\marg{csv list
6026 % of options} can be used in the preamble or at any point of the
6027 % document, except inside environments set to receive an apparatus
6028 % criticus, namely the \env{ekdosis} environment or any other similar
6029 % environment declared by means of the \env{alignment} environment or
6030 % \cs{SetAlignment}.\footnote{See above
6031 % \vref{sec:multiple-alignment}.} At the time of writing, there is
6032 % only one option, as follows:---\\
6033 % \DescribeOption{autopar} |autopar|$=$\verb+true|false+
6034 % \hfill\tcboxverb{Default: true}\\
6035 % The algorithm described above applies for edition texts composed in
6036 % running paragraphs or lines of poetry, but it may fail to produce a
6037 % valid \texttt{TEI xml} output with other arrangements, such as
6038 % performance texts or transcriptions of speech for which the
6039 % \texttt{TEI} Guidelines define specific rules. |autopar=false|
6040 % instructs \pkg{ekdosis} to ignore blank lines in the |.tex| source
6041 % file as markers for paragraph boundaries. As a result, each
6042 % paragraph of the edition text must be found within an environment
6043 % associated with the \texttt{xml} element |<p>|, such as \env{ekdpar}
6044 % or any other environment declared as such by means of \cs{EnvtoTEI}
6045 % described below in \vref{sec:new-cmds-envs}. A typical use case of
6046 % |autopar=false| is provided below in
6047 % \vref{sec:specific-tei-modules}.
6048 %
6049 % \DescribeEnv{ekdpar} \cs{begin}|{ekdpar}| \dots\ \cs{end}|{ekdpar}|
6050 % is a simple environment that does nothing but insert \cs{par}
6051 % primitives. It can be used to instruct \pkg{ekdosis} to place
6052 % paragraphs within |<p>| elements when |autopar| has been set to
6053 % |false| by means of \cs{SetTEIxmlExport} described above.
6054 %
6055 % \paragraph{The \texttt{xml:id} Attribute}
6056 % \phts\label{ref:xmlid} As a general rule, the |xml:id| global
6057 % attribute must be unique for the element that bears the
6058 % attribute. Furthermore, it must begin with a letter or an underscore
6059 % and contain no characters other than letters of the Latin
6060 % alphabet\--- from |a| to |z|, either upper or lower case\---digits,
6061 % hyphens, underscores and full stops. \pkg{ekdosis} issues a warning
6062 % when it finds that any \meta{unique id} of \meta{unique label}
6063 % expected in the first argument of \cs{DeclareWitness},
6064 % \cs{DeclareHand}, \cs{DeclareSource} or \cs{DeclareScholar} is not
6065 % unique or breaks the rules just described, but does not prevent the
6066 % |.tex| source file from compiling. Instead, it prints the string
6067 % |<??>| in place of the expected formatted siglum so that the error
6068 % in the |.tex| source file can be easily spotted and corrected.
6069 %
6070 % \danger As the \meta{unique id} declared with \cs{DeclareShorthand}
6071 % is not to be exported in the \texttt{TEI xml} output file,
6072 % \pkg{ekdosis} checks neither its uniqueness nor its validness.
6073 %
6074 % \danger It must be noted that \LaTeX\ labels that are provided in
6075 % commands such as \cs{label}, \cs{cite} and the like must also be
6076 % unique in the document. As \LaTeX\ will issue warnings if duplicates
6077 % be found, \cs{ekdosis} does not check their uniqueness but will
6078 % issue warnings if such labels contain invalid strings.
6079 %
6080 % \subsection{Routine \LaTeX\ Commands and Environments}
6081 % \label{sec:routine-cmds}
6082 % The list of \LaTeX\ commands known by \pkg{ekdosis} at the time of
6083 % writing follows. To this list must be added the \LaTeX\ standard
6084 % commands that are used for sectional divisions as described above in
6085 % \vref{sec:latex-divs} and most of the commands provided by the
6086 % \pkg{arabluatex} and \pkg{icite}\footcite{icite} packages. Standard
6087 % citation commands are also supported as will be described below in
6088 % \vref{sec:citation-cmds}:---
6089 %
6090 % \begin{xltabular}{0.825\linewidth}{XX}
6091 % \toprule
6092 % \LaTeX\ command & \texttt{TEI xml} element\\
6093 % \midrule\endhead
6094 % \cs{textsuperscript}|{}| & |<hi rend="sup"></hi>| \\
6095 % \cs{textsubscript}|{}| & |<hi rend="sub"></hi>| \\
6096 % \cs{textbf}|{}| & |<hi rend="bold"></hi>| \\
6097 % \cs{textit}|{}| & |<hi rend="italic"></hi>| \\
6098 % \cs{textsc}|{}| & |<hi rend="smallcaps"></hi>| \\
6099 % \cs{textsf}|{}| & |<hi rend="sf"></hi>| \\
6100 % \cs{footnote}|{}| & |<note place="bottom"></note>| \\
6101 % \cs{marginpar}|{}| & |<note place="margin"></note>| \\
6102 % \cs{enquote}\meta{*}|{}| & |<quote></quote>| \\
6103 % \cs{label}|{label}| & |<anchor xml:id="label"/>| \\
6104 % \cs{linelabel}|{label}| & |<anchor xml:id="label"/>| \\
6105 % \cs{ref}|{label}| & |<ptr ="#label"/>| \\
6106 % \cs{pageref}|{label}| & |<ptr ="#label"/>| \\
6107 % \cs{vref}|{label}| & |<ptr ="#label"/>| \\
6108 % \cs{vpageref}|{label}| & |<ptr ="#label"/>| \\
6109 % \cs{pagebreak}\meta{\oarg{1-4}} & no output \\
6110 % \cs{mbox}\marg{text} & \meta{text} \\
6111 % \midrule
6112 % \multicolumn{2}{c}{From the \pkg{extdash}\footcite{extdash}
6113 % package:}\\
6114 % \cs{---} or \cs{===} & --- \\
6115 % \cs{--} or \cs{==} & -- \\
6116 % \cs{-/} or \cs{=/} & ‐ \\
6117 % \bottomrule
6118 % \end{xltabular}
6119 %
6120 % As for environments:---
6121 %
6122 % \begin{xltabular}{0.825\linewidth}{XX}
6123 % \toprule
6124 % \LaTeX\ environment & \texttt{TEI xml} element\\
6125 % \midrule\endhead
6126 % |flushright| & |<p rend="align(right)"></p>| \\
6127 % |flushleft| & |<p rend="align(left)"></p>| \\
6128 % |center| & |<p rend="align(center)"></p>| \\
6129 % |quotation| & |<quote></quote>| \\
6130 % |quoting| & |<quote></quote>| \\
6131 % |verse| & |<lg></lg>| \\
6132 % \bottomrule
6133 % \end{xltabular}
6134 %
6135 % Regarding other, very frequently used commands or environments, some
6136 % do not need to be inserted in the translation tables: as already
6137 % said above, \pkg{ekdosis} converts by default the original names of
6138 % these into \texttt{xml} elements. For instance, \cs{emph}|{}| and
6139 % \cs{begin}|{quote}| \dots\ \cs{end}|{quote}| will result in
6140 % |<emph></emph>| and |<quote></quote>| respectively.
6141 %
6142 % For the same simple reason, should one wish to have words within a
6143 % \texttt{TEI xml} element that does not have any \LaTeX\ equivalent,
6144 % all is needed is to define an inoperative \LaTeX\ command named
6145 % after the \texttt{TEI} element, like so:---
6146 %
6147 % \iffalse
6148 %<*example>
6149 % \fi
6150 \begin{minted}[linenos=false]{latex}
6151 % Preamble:
6152 \newcommand{\mentioned}[1]{#1}
6153
6154 % Document:
6155
6156 Our usage corresponds to the \mentioned{aggregate} of many
6157 mathematical writings and to the sense of \mentioned{class} found in
6158 older logical writings.
6159 \end{minted}
6160 % \iffalse
6161 %</example>
6162 % \fi
6163 %
6164 % \texttt{TEI xml} output:---
6165 %
6166 % \iffalse
6167 %<*example>
6168 % \fi
6169 \begin{minted}[linenos=false]{xml}
6170 <p>Our usage corresponds to the <mentioned>aggregate</mentioned> of
6171 many mathematical writings and to the sense of
6172 <mentioned>class</mentioned> found in older logical writings.</p>
6173 \end{minted}
6174 % \iffalse
6175 %</example>
6176 % \fi
6177 %
6178 % Of course, it is also possible to have the \enquote{mentioned} words
6179 % printed in a different font family:---
6180 %
6181 % \iffalse
6182 %<*example>
6183 % \fi
6184 \begin{minted}[linenos=false]{latex}
6185 \newcommand{\mentioned}[1]{\textsf{#1}}
6186 \end{minted}
6187 % \iffalse
6188 %</example>
6189 % \fi
6190 %
6191 % This command will print them in a sans serif font family, with the
6192 % exact same \texttt{TEI xml} output as above.
6193 %
6194 % \subsection{Processing New Commands or Environments}
6195 % \label{sec:new-cmds-envs}
6196 % The following three commands are provided to instruct \pkg{ekdosis}
6197 % how to convert unknown or unusual \hologo{(La)TeX} commands or
6198 % environments into \texttt{TEI xml} equivalents.
6199 %
6200 % \DescribeMacro{\TeXtoTEI} \cs{TeXtoTEI}\marg{csname}\marg{TEI
6201 % element}\oarg{TEI attribute(s)}\\
6202 % \cs{TeXtoTEI} takes two mandatory arguments and one optional
6203 % argument, namely: the control sequence name to be converted, the
6204 % \texttt{TEI} element it is to be converted into and any additional
6205 % \texttt{xml} attributes to be appended to the opening \texttt{TEI}
6206 % element. For example, the \cs{sidenote} command that is provided by
6207 % the \pkg{sidenotes} package can be processed like so:---
6208 %
6209 % \iffalse
6210 %<*example>
6211 % \fi
6212 \begin{minted}[linenos=false]{latex}
6213 % Preamble:
6214 \TeXtoTEI{sidenote}{note}[place="margin"]
6215
6216 % Document:
6217 \begin{ekdosis}
6218 \begin{ekdverse}
6219 The self-same moment I could pray;\sidenote{The spell begins to
6220 break}\footnote{The turning point of the poem...}
6221 \end{ekdverse}
6222 \end{ekdosis}
6223 \end{minted}
6224 % \iffalse
6225 %</example>
6226 % \fi
6227 %
6228 % \texttt{TEI xml} output:---
6229 %
6230 % \iffalse
6231 %<*example>
6232 % \fi
6233 \begin{minted}[linenos=false]{xml}
6234 <lg>
6235 <l>The self-same moment I could pray;
6236 <note place="margin">The spell begins to break</note>
6237 <note place="bottom">The turning point of the
6238 poem...</note></l>
6239 </lg>
6240 \end{minted}
6241 % \iffalse
6242 %</example>
6243 % \fi
6244 %
6245 % Even more subtly, provided that the code |#STC| points to some more
6246 % information identifying the agency concerned:\footnote{At the time
6247 % of writing, \enquote*{sources} can be declared with
6248 % \cs{DeclareSource} as described above
6249 % \vpageref{ref:declare-source}. Then the unique identifier used in
6250 % the first argument of this command can point to the list of
6251 % references inserted by \pkg{ekdosis} in the back matter section of
6252 % the \texttt{TEI} output file. See below
6253 % \vref{sec:references-cited-works} for more information on how to do
6254 % this. Scholars can also be referred to as individuals by means of
6255 % the \cs{DeclareScholar} command. See above
6256 % \vpageref{ref:declare-source}.}---
6257 %
6258 % \iffalse
6259 %<*example>
6260 % \fi
6261 \begin{minted}[linenos=false]{latex}
6262 % Preamble:
6263 \usepackage{sidenotes}
6264 \usepackage[teiexport=tidy]{ekdosis}
6265
6266 \TeXtoTEI{sidenote}{note}[place="margin"]
6267
6268 \newcommand{\STCsnote}[1]{\sidenote{#1}}
6269 \TeXtoTEI{STCsnote}{note}[place="margin" resp="#STC"]
6270
6271 % Document:
6272 \begin{ekdosis}
6273 \begin{ekdverse}
6274 The self-same moment I could pray;\STCsnote{The spell begins to
6275 break}\footnote{The turning point of the poem...}
6276 \end{ekdverse}
6277 \end{ekdosis}
6278 \end{minted}
6279 % \iffalse
6280 %</example>
6281 % \fi
6282 %
6283 % \texttt{TEI xml} output:---
6284 %
6285 % \iffalse
6286 %<*example>
6287 % \fi
6288 \begin{minted}[linenos=false]{xml}
6289 <lg>
6290 <l>The self-same moment I could pray;
6291 <note place="margin" resp="#STC">The spell begins to
6292 break</note>
6293 <note place="bottom">The turning point of the
6294 poem...</note></l>
6295 </lg>
6296 \end{minted}
6297 % \iffalse
6298 %</example>
6299 % \fi
6300 %
6301 % \DescribeMacro{\EnvtoTEI} \DescribeMacro{\EnvtoTEI*}
6302 % \cs{EnvtoTEI}\meta{*}\marg{env name}\marg{TEI element}\oarg{TEI
6303 % attribute(s)}\\
6304 % \cs{EnvtoTEI} instructs \pkg{ekdosis} how to convert \LaTeX\
6305 % environments into \texttt{TEI xml} equivalents. It takes two
6306 % mandatory arguments and one optional argument, namely the name of
6307 % the \LaTeX\ environment to be converted, the \texttt{TEI} element it
6308 % is to be converted into and any additional attributes to be appended
6309 % to the \texttt{TEI} opening element. \cs{EnvtoTEI*} is restricted to
6310 % \texttt{TEI} elements that must never appear within |<p>| elements,
6311 % such as |<p>| itself, |<div>|, |<lg>| and the like. The following
6312 % example illustrates how \cs{EnvtoTEI} can be used conjointly with
6313 % \pkg{babel} to convey information about the languages used from
6314 % \LaTeX\ to \texttt{TEI}:---
6315 %
6316 % \phts\label{ref:ancientgreek-ex}
6317 % \iffalse
6318 %<*example>
6319 % \fi
6320 \begin{minted}[linenos=false]{latex}
6321 % Preamble:
6322 % Use babel and babeltags:
6323 \usepackage[greek.ancient, english]{babel}
6324 \babeltags{ancientgreek = greek}
6325
6326 \EnvtoTEI{ancientgreek}{p}[xml:lang="grc"]
6327
6328 % Document:
6329 \begin{ekdosis}
6330 \begin{ancientgreek}
6331 περὶ πολλοῦ ἂν ποιησαίμην, ὦ ἄνδρες, τὸ τοιούτους ὑμᾶς ἐμοὶ
6332 δικαστὰς περὶ τούτου τοῦ πράγματος γενέσθαι, οἷοίπερ ἂν ὑμῖν
6333 αὐτοῖς εἴητε τοιαῦτα πεπονθότες...
6334 \end{ancientgreek}
6335 \end{ekdosis}
6336 \end{minted}
6337 % \iffalse
6338 %</example>
6339 % \fi
6340 %
6341 % \texttt{TEI xml} output:---
6342 %
6343 % \iffalse
6344 %<*example>
6345 % \fi
6346 \begin{minted}[linenos=false]{xml}
6347 <p xml:lang="grc">περὶ πολλοῦ ἂν ποιησαίμην, ὦ ἄνδρες, τὸ
6348 τοιούτους ὑμᾶς ἐμοὶ δικαστὰς περὶ τούτου τοῦ πράγματος
6349 γενέσθαι, οἷοίπερ ἂν ὑμῖν αὐτοῖς εἴητε τοιαῦτα πεπονθότες...</p>
6350 \end{minted}
6351 % \iffalse
6352 %</example>
6353 % \fi
6354 %
6355 % \DescribeMacro{\TeXtoTEIPat}
6356 % \phts\label{ref:textoteipat}
6357 % \cs{TeXtoTEIPat}\marg{\TeX\ pattern}\marg{TEI pattern}\\
6358 % Finally, this more flexible\---and more delicate to
6359 % handle\---command uses pattern matching to instruct \pkg{ekdosis}
6360 % how to convert \hologo{(La)TeX} commands into \texttt{TEI}
6361 % equivalents. In the first mandatory argument, strings to be captured
6362 % are marked in sequence with numbers prefixed by |#|, like so: |#1|,
6363 % |#2|, |#3| and so forth. Then, in the second mandatory argument, the
6364 % strings captured are inserted where each of them is expected in
6365 % the \texttt{TEI} element.
6366 %
6367 % \danger If the entire string to be captured be enclosed in square or
6368 % curly brackets, it is advisable to use |@b|\texttt{\emph{n}} (for
6369 % curly brackets) or |@s|\texttt{\emph{n}} (for square brackets)
6370 % instead of |#|\texttt{\emph{n}}, where \texttt{\emph{n}} is the
6371 % number that is expected in the sequence. This will prevent any
6372 % brackets that may be found in the captured string from being
6373 % interpreted.
6374 %
6375 % \danger Strings must be entered exactly as \pkg{ekdosis} will find
6376 % them as the |.tex| source file is compiled. Specifically,
6377 % \emph{control sequences}, namely the coded commands immediately
6378 % preceded by `\verb+\+' are always found followed by a space. For
6379 % instance, |\emph{}| will be seen and processed by \pkg{ekdosis} as
6380 % \verb*|\emph {}|.
6381 %
6382 % The following example illustrates how \pkg{ekdosis} can be
6383 % instructed to process the
6384 % \cs{textcolor}\allowbreak\marg{color}\marg{text} command:---
6385 %
6386 % \iffalse
6387 %<*example>
6388 % \fi
6389 \begin{minted}[linenos]{latex}
6390 \TeXtoTEIPat{\textcolor␣{#1}@b2}{<hi rend="#1">@b2</hi>}
6391
6392 Sample text with a \textcolor{red}{word} in red.
6393 \end{minted}
6394 % \iffalse
6395 %</example>
6396 % \fi
6397 %
6398 % \begin{remarks}
6399 % \item[\textsc{Rem.}] As can be seen from l.~1, it is safe to use
6400 % |#1| for the first string for color names are naturally formed of
6401 % letters without braces. However, |@b2| is preferable to capture
6402 % the whole second argument of \cs{textcolor} for it may contain
6403 % words within braces.
6404 % \end{remarks}
6405 %
6406 % \iffalse
6407 %<*example>
6408 % \fi
6409 \begin{minted}[linenos=false]{xml}
6410 <p>Sample text with a
6411 <hi rend="red">word</hi>in red.</p>
6412 \end{minted}
6413 % \iffalse
6414 %</example>
6415 % \fi
6416 %
6417 % \subsection{Inserting Code in the \texttt{TEI xml} Ouput File}
6418 % \label{sec:inserting-code-tei}
6419 % It may be needed to insert code in the \texttt{TEI xml} output file
6420 % only, for example when clear enough information is written in the
6421 % apparatus criticus by means of such optional arguments as |pre|,
6422 % |post|, |prewit| or |postwit| that are not processed for \texttt{TEI
6423 % xml} ouput.\footnote{See above \vref{sec:single-text-editing}.}
6424 %
6425 % \needspace{2\baselineskip}
6426 % \DescribeMacro{\teidirect} \newfeature[v1.3] \cs{teidirect}\oarg{xml
6427 % attributes}\marg{xml element}\marg{code}\\
6428 % Two mandatory arguments are expected by \cs{teidirect}, namely the
6429 % \texttt{TEI xml} element followed by the contents to be found in the
6430 % ouput file between the opening and closing tags. Additionally,
6431 % attribute-value pairs to be found inside the start-tag of the
6432 % element can be specified in the optional argument of the command. An
6433 % example follows:
6434 %
6435 % \iffalse
6436 %<*example>
6437 % \fi
6438 \begin{minted}[linenos]{latex}
6439 % Preamble:
6440 \DeclareWitness{GalE1.M}{Gal.E1(M)}{\emph{Monacencis Gr.}
6441 231}[origDate=s. XVI]
6442 \DeclareWitness{GalE1.Q}{Gal.E1(Q)}{\emph{Parisinus Gr.}
6443 2174}[origDate=s. XIV]
6444 \DeclareShorthand{GalE1.M.Q}{Gal.E1(MQ)}{GalE1.M,GalE1.Q}
6445
6446 % Document:
6447 ἐν \app{
6448 \lem[wit=codd]{καύμασιν}
6449 \rdg[wit=GalE1.M.Q, postwit=\unskip(23.16)]{καύματι}
6450 \teidirect{note}{p. 23, l. 16 Wenkebach}}
6451 \end{minted}
6452 % \iffalse
6453 %</example>
6454 % \fi
6455 %
6456 % \begin{remarks}
6457 % \item |GalE1.M.Q| (l.~11) has been defined as a shorthand to denote
6458 % the agreement of two otherwise defined manuscripts by means of
6459 % \cs{DeclareWitness}: |GalE1.M| and |GalE1.Q|. (See ll.~2--6.)
6460 % \item The |postwit| optional argument has been used to further
6461 % specify the location where this variant reading can be found in
6462 % the critical edition of Galen's Commentary on Hippocrates'
6463 % \emph{Epidemics}, Book~1 (l.~11). But as the effect of |postwit|
6464 % is limited to the PDF output, \cs{teidirect} has been used to
6465 % convey this item of information to the \texttt{TEI xml} ouput file
6466 % (l.~12).
6467 % \end{remarks}
6468 %
6469 % PDF output:---
6470 % \medskip
6471 %
6472 % \needspace{7\baselineskip}
6473 % \resetlinenumber
6474 % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
6475 % \begin{specimen}
6476 % \begin{ancientgreek}
6477 % ἐν \app{
6478 % \lem[wit=hcodd]{καύμασιν}
6479 % \rdg[wit=hGalE1.M.Q, postwit=\unskip(23.16)]{καύματι}
6480 % \teidirect{note}{p. 23, l. 16 Wenkebach}}
6481 % \end{ancientgreek}
6482 % \end{specimen}
6483 % \end{alignment}
6484 %
6485 % \texttt{TEI xml} output:---
6486 %
6487 % \iffalse
6488 %<*example>
6489 % \fi
6490 \begin{minted}[linenos]{xml}
6491 <p xml:lang="grc">ἐν
6492 <app>
6493 <lem wit="#V #I #R #H">καύμασιν</lem>
6494 <rdg wit="#GalE1.#M #GalE1.Q">καύματι</rdg>
6495 <note>p. 23, l. 16 Wenkebach</note>
6496 </app></p>
6497 \end{minted}
6498 % \iffalse
6499 %</example>
6500 % \fi
6501 %
6502 % \subsection{Specific \texttt{TEI} Modules}
6503 % \label{sec:specific-tei-modules}
6504 % The following example illustrates how \pkg{ekdosis} can be adapted
6505 % in a straightforward way to modules provided by the \texttt{TEI} for
6506 % encoding specific texts such as transcriptions of
6507 % speech.\footnote{See
6508 % \url{https://tei-c.org/release/doc/tei-p5-doc/en/html/TS.html}.} The
6509 % technique applied below uses \cs{EnvtoTEI} conjointly with
6510 % \cs{SetTEIxmlExport}|{autopar=|\allowbreak|false}| described above
6511 % \vpageref{ref:setteixmlexport}:---
6512 %
6513 % \iffalse
6514 %<*example>
6515 % \fi
6516 \begin{minted}{latex}
6517 % Preamble:
6518 \newenvironment{speech}{\par}{\par}
6519 \newcommand{\speaker}[1]{\textbf{#1}\par}
6520 \EnvtoTEI{speech}{sp}
6521
6522 \SetTEIxmlExport{autopar=false}
6523
6524 % Document:
6525 \begin{ekdosis}
6526 \begin{speech}
6527 \speaker{Σωκράτης}
6528 \begin{ekdpar}
6529 κατέβην χθὲς εἰς Πειραιᾶ μετὰ Γλαύκωνος τοῦ Ἀρίστωνος
6530 προσευξόμενός τε τῇ θεῷ καὶ ἅμα τὴν ἑορτὴν βουλόμενος θεάσασθαι
6531 τίνα τρόπον ποιήσουσιν ἅτε νῦν πρῶτον ἄγοντες. καλὴ μὲν οὖν μοι
6532 καὶ ἡ τῶν ἐπιχωρίων πομπὴ ἔδοξεν εἶναι, οὐ μέντοι ἧττον ἐφαίνετο
6533 πρέπειν ἣν οἱ Θρᾷκες ἔπεμπον.
6534 \end{ekdpar}
6535 \end{speech}
6536 \end{ekdosis}
6537 \end{minted}
6538 % \iffalse
6539 %</example>
6540 % \fi
6541 %
6542 % \begin{remarks}
6543 % \item Lines~2--3 define a basic environment meant to contain
6544 % individual speeches and a command to hold the name of the
6545 % speaker. This name is printed in bold face and followed by a new
6546 % paragraph in the PDF output.
6547 % \item Line~4 instructs \pkg{ekdosis} to convert \env{speech} \LaTeX\
6548 % environments into |<sp>| \texttt{TEI xml} elements.
6549 % \item Line~6 disables the |autopar| algorithm that \pkg{ekdosis}
6550 % provides by default for running paragraphs of text. As a
6551 % consequence, \env{ekdpar} is used to mark the paragraphs.
6552 % \end{remarks}
6553 %
6554 % PDF output:---
6555 % \medskip
6556 %
6557 % \needspace{7\baselineskip}
6558 % \SetTEIxmlExport{autopar=false}
6559 % \begingroup
6560 % \newenvironment{speech}{\par\selectlanguage{greek}}{\par}
6561 % \newcommand{\speaker}[1]{\textbf{#1}\par}
6562 % \EnvtoTEI{speech}{sp}
6563 % \resetlinenumber
6564 % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
6565 % \begin{specimen}
6566 % \begin{speech}
6567 % \speaker{Σωκράτης}
6568 % \begin{ekdpar}
6569 % κατέβην χθὲς εἰς Πειραιᾶ μετὰ Γλαύκωνος τοῦ Ἀρίστωνος
6570 % προσευξόμενός τε τῇ θεῷ καὶ ἅμα τὴν ἑορτὴν βουλόμενος θεάσασθαι
6571 % τίνα τρόπον ποιήσουσιν ἅτε νῦν πρῶτον ἄγοντες. καλὴ μὲν οὖν μοι
6572 % καὶ ἡ τῶν ἐπιχωρίων πομπὴ ἔδοξεν εἶναι, οὐ μέντοι ἧττον ἐφαίνετο
6573 % πρέπειν ἣν οἱ Θρᾷκες ἔπεμπον.
6574 % \end{ekdpar}
6575 % \end{speech}
6576 % \end{specimen}
6577 % \end{alignment}
6578 % \endgroup
6579 % \SetTEIxmlExport{autopar=true}
6580 %
6581 % \texttt{TEI xml} output:---
6582 %
6583 % \iffalse
6584 %<*example>
6585 % \fi
6586 \begin{minted}[linenos=false]{xml}
6587 <sp>
6588 <speaker>Σωκράτης</speaker>
6589 <p>κατέβην χθὲς εἰς Πειραιᾶ μετὰ Γλαύκωνος τοῦ Ἀρίστωνος
6590 προσευξόμενός τε τῇ θεῷ καὶ ἅμα τὴν ἑορτὴν βουλόμενος
6591 θεάσασθαι τίνα τρόπον ποιήσουσιν ἅτε νῦν πρῶτον ἄγοντες.
6592 καλὴ μὲν οὖν μοι καὶ ἡ τῶν ἐπιχωρίων πομπὴ ἔδοξεν εἶναι, οὐ
6593 μέντοι ἧττον ἐφαίνετο πρέπειν ἣν οἱ Θρᾷκες ἔπεμπον.</p>
6594 </sp>
6595 \end{minted}
6596 % \iffalse
6597 %</example>
6598 % \fi
6599 %
6600 % \subsection{References to Cited Works}
6601 % \label{sec:references-cited-works}
6602 % A full example of what is technically called a \emph{Conspectus
6603 % Siglorum} can be found above in \vref{sec:print-witnesses}. Such a
6604 % list of manuscript sigla should be found immediately before the
6605 % edition text. Traditionally, this section is followed by a list of
6606 % other sources used to establish the text, so that the edited text is
6607 % in the end established both from manuscript evidence (the
6608 % \enquote{witnesses}) and other works based on a scholarly approach
6609 % of the text (the \enquote{sources}) which are called in Latin
6610 % \emph{Editiones uel Studia}. As a consequence of this classification
6611 % as \enquote{witness} or \enquote{source}, the former must go within
6612 % the |<listWit>| element of the \texttt{TEI} header, whereas the
6613 % latter is to be found within the |<listBibl>| element.
6614 %
6615 % \DescribeMacro{\AddxmlBibResource}
6616 % \cs{AddxmlBibResource}\marg{basename or name.xml} is a preamble-only
6617 % command. If a base name (either suffixed with |.xml| or not) for a
6618 % \texttt{TEI xml}-compliant bibliographical database be provided,
6619 % \pkg{ekdosis} will use it and insert formatted data in the back
6620 % matter section of its own \texttt{TEI xml} output file, as
6621 % |<biblStruct>| elements within a |listBibl| section.
6622 %
6623 % As an example, the following Bib\hologo{(La)TeX} entry and its
6624 % \texttt{TEI} equivalent are provided:\footnote{\label{fn:zotero}To
6625 % the author's knowledge, \textsf{Zotero}
6626 % (\url{https://www.zotero.org}) provides excellent \texttt{TEI xml}
6627 % output from Bib\hologo{(La)TeX} input files.}---
6628 %
6629 % \iffalse
6630 %<*example>
6631 % \fi
6632 \begin{minted}{bibtex}
6633 @Book{Drak,
6634 title = {Punicorum Libri Septemdecim},
6635 author = {Silius Italicus, Tiberius Catius},
6636 editor = {Drakenborch, Arnold},
6637 date = {1717},
6638 publisher = {Trajecti ad Rhenum},
6639 location = {Utrecht}
6640 }
6641 \end{minted}
6642 % \iffalse
6643 %</example>
6644 % \fi
6645 %
6646 % \iffalse
6647 %<*example>
6648 % \fi
6649 \begin{minted}{xml}
6650 <?xml version="1.0" encoding="UTF-8"?>
6651 <listBibl xmlns="http://www.tei-c.org/ns/1.0">
6652 <biblStruct type="book" xml:id="Drak">
6653 <monogr>
6654 <title level="m">Punicorum libri septemdecim</title>
6655 <author>
6656 <forename>Tiberius Catius</forename>
6657 <surname>Silius Italicus</surname>
6658 </author>
6659 <editor>
6660 <forename>Arnold</forename>
6661 <surname>Drakenborch</surname>
6662 </editor>
6663 <imprint>
6664 <pubPlace>Utrecht</pubPlace>
6665 <publisher>Trajecti ad Rhenum</publisher>
6666 <date>1717</date>
6667 </imprint>
6668 </monogr>
6669 </biblStruct>
6670 </listBibl>
6671 \end{minted}
6672 % \iffalse
6673 %</example>
6674 % \fi
6675 %
6676 % \danger As can be seen, the same string |Drak| is used as a label in
6677 % the Bib\hologo{(La)TeX} file (l.~1) and an |xml:id| in the
6678 % \texttt{TEI} file (l.~3). This same label must be used again in the
6679 % preamble of the |.tex| source file to declare Arnold Drakenborch as a
6680 % source,\footnote{See above \vpageref{ref:declare-source}.} like
6681 % so:---
6682 %
6683 % \iffalse
6684 %<*example>
6685 % \fi
6686 \begin{minted}{latex}
6687 % Use 'bibl.xml' as a TEI xml bibliographical database:
6688 \AddxmlBibResource{bibdata.xml}
6689
6690 % Declare A. Drakenborch as source:
6691 \DeclareSource{Drak}{\emph{Drakenborch}}
6692 \end{minted}
6693 % \iffalse
6694 %</example>
6695 % \fi
6696 %
6697 % \phts\label{ref:ekdverse-ex}
6698 % Finally, an extract of Silius Italicus' \emph{Punica}, Book~9,
6699 % ll.~30-2 follows (|.tex| source file, PDF output and \texttt{TEI}
6700 % output files):---
6701 %
6702 % \iffalse
6703 %<*example>
6704 % \fi
6705 \begin{minted}{latex}
6706 % Preamble:
6707 \usepackage[style=oxnotes]{biblatex}
6708 \addbibresource{bibdata.bib}
6709
6710 \usepackage[teiexport=tidy]{ekdosis}
6711
6712 % basename of the .xml bibliographical database:
6713 \AddxmlBibResource{bibdata.xml}
6714
6715 % Witnesses:
6716 \DeclareWitness{L}{L}{Laurentianus, plut, XXXVII, cod. 16}[
6717 origDate=s. XV]
6718 % Other witnesses [...]
6719
6720 % Sources:
6721 \DeclareSource{Drak}{\emph{Drakenborch}}
6722 % Alternatively, use BibLaTeX for the rendition:
6723 % \DeclareSource{Drak}{\citename{Drak}{editor}}
6724 % Other sources [...]
6725
6726 % Document:
6727 \begin{ekdosis}
6728 \begin{ekdverse}
6729 Sed uos, quorum oculos atque ora humentia uidi,\\
6730 uertere cum consul terga et remeare iuberet,\\
6731 \app{
6732 \lem[source=Drak, type=emendation]{ne morem}
6733 \rdg[wit={L, F}]{me morem}
6734 \rdg[wit={O, V}]{memorem}
6735 } et pugnae signum exspectate petendae:\\
6736 \end{ekdverse}
6737 \end{ekdosis}
6738 \end{minted}
6739 % \iffalse
6740 %</example>
6741 % \fi
6742 %
6743 % PDF output:---
6744 % \medskip
6745 %
6746 % \needspace{7\baselineskip}
6747 % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
6748 % \resetlinenumber\resetvlinenumber[30]
6749 % \setlength{\vrightskip}{-1.5in}
6750 % \begin{specimen}
6751 % \begin{ekdverse}
6752 % Sed uos, quorum oculos atque ora humentia uidi,\\
6753 % uertere cum consul terga et remeare iuberet,\\
6754 % \app{
6755 % \lem[source=sDrak, type=emendation]{ne morem}
6756 % \rdg[wit={sL, sF}]{me morem}
6757 % \rdg[wit={sO, sV}]{memorem}
6758 % } et pugnae signum exspectate petendae:\\
6759 % \end{ekdverse}
6760 % \end{specimen}
6761 % \end{alignment}
6762 %
6763 % \texttt{TEI xml} output file produced by \pkg{ekdosis} (narrowed
6764 % down to the |<text>| element):---
6765 %
6766 % \iffalse
6767 %<*example>
6768 % \fi
6769 \begin{minted}{xml}
6770 <text>
6771 <body>
6772 <lg>
6773 <l>Sed uos, quorum oculos atque ora humentia uidi,</l>
6774 <l>uertere cum consul terga et remeare iuberet,</l>
6775 <l>
6776 <app>
6777 <lem source="#Drak" type="emendation">ne morem</lem>
6778 <rdg wit="#L #F">me morem</rdg>
6779 <rdg wit="#O #V">memorem</rdg>
6780 </app>et pugnae signum exspectate petendae:</l>
6781 </lg>
6782 </body>
6783 <back>
6784 <listBibl>
6785 <biblStruct type="book" xml:id="Drak">
6786 <monogr>
6787 <title level="m">Punicorum libri septemdecim</title>
6788 <author>
6789 <forename>Tiberius Catius</forename>
6790 <surname>Silius Italicus</surname>
6791 </author>
6792 <editor>
6793 <forename>Arnold</forename>
6794 <surname>Drakenborch</surname>
6795 </editor>
6796 <imprint>
6797 <pubPlace>Utrecht</pubPlace>
6798 <publisher>Trajecti ad Rhenum</publisher>
6799 <date>1717</date>
6800 </imprint>
6801 </monogr>
6802 </biblStruct>
6803 </listBibl>
6804 </back>
6805 </text>
6806 \end{minted}
6807 % \iffalse
6808 %</example>
6809 % \fi
6810 %
6811 % \subsection{Citation Commands}
6812 % \label{sec:citation-cmds}
6813 % \pkg{ekdosis} can also convert into \texttt{TEI xml} references to
6814 % cited works. Depending on the optional arguments used in the
6815 % citation command, references will be converted into |<ptr>| or
6816 % |<bibl>| elements with the appropriate identifier supplied by means
6817 % of the |target| or |corresp| attributes.
6818 %
6819 % Of course, for this mechanism to work, Bib\TeX\ or Bib\LaTeX\ must
6820 % be used and connected to some |.bib| bibliographical database
6821 % file. Additionally, this |.bib| file must have been converted into a
6822 % \texttt{TEI xml}-compliant file where all the Bib\hologo{(La)TeX}
6823 % entries that are used in the document are found within
6824 % |<biblStruct>| elements.\footnote{See above n.~\vref{fn:zotero} for
6825 % information on how to do this.} Finally, this |.xml| bibliographical
6826 % database must have been connected to the |.tex| source file by means
6827 % of \cs{AddxmlBibResource} described above in
6828 % \vref{sec:references-cited-works}.
6829 %
6830 % As an example, the following |sample.bib| file is used:---
6831 %
6832 % \iffalse
6833 %<*example>
6834 % \fi
6835 \begin{minted}[linenos=false]{bibtex}
6836 @Book{ReynoldsWilson1991,
6837 author = {Reynolds, L. D. and Wilson, N. G.},
6838 title = {Scribes and Scholars},
6839 year = {1991},
6840 subtitle = {A Guide to the Translation of Greek and Latin
6841 Literature},
6842 edition = {3},
6843 publisher = {Clarendon Press},
6844 location = {Oxford}
6845 }
6846 \end{minted}
6847 % \iffalse
6848 %</example>
6849 % \fi
6850 %
6851 % It has been converted into |sample.xml| as follows:---
6852 %
6853 % \iffalse
6854 %<*example>
6855 % \fi
6856 \begin{minted}[linenos=false]{xml}
6857 <?xml version="1.0" encoding="UTF-8"?>
6858 <listBibl xmlns="http://www.tei-c.org/ns/1.0">
6859 <biblStruct type="book" xml:id="ReynoldsWilson1991">
6860 <monogr>
6861 <title level="m">Scribes and Scholars</title>
6862 <author>
6863 <forename>L. D.</forename>
6864 <surname>Reynolds</surname>
6865 </author>
6866 <author>
6867 <forename>N. G.</forename>
6868 <surname>Wilson</surname>
6869 </author>
6870 <edition>3</edition>
6871 <imprint>
6872 <pubPlace>Oxford</pubPlace>
6873 <publisher>Clarendon Press</publisher>
6874 <date>1991</date>
6875 </imprint>
6876 </monogr>
6877 </biblStruct>
6878 </listBibl>
6879 \end{minted}
6880 % \iffalse
6881 %</example>
6882 % \fi
6883 %
6884 % Once both files have been prepared, inserting references and
6885 % exporting them into the \texttt{TEI xml} output file can be achieved
6886 % in a straightforward way. (The full |sample.tex| is provided
6887 % below.)---
6888 %
6889 % \iffalse
6890 %<*example>
6891 % \fi
6892 \begin{minted}[linenos=false]{latex}
6893 \documentclass{article}
6894
6895 \usepackage[teiexport=tidy]{ekdosis}
6896 \AddxmlBibResource{sample.xml}
6897
6898 \usepackage[style=oxnotes]{biblatex}
6899 \addbibresource{sample.bib}
6900
6901 \begin{document}
6902 \begin{ekdosis}
6903 On textual criticism, see \cite[207--241]{ReynoldsWilson1991}.
6904 \end{ekdosis}
6905 \end{document}
6906 \end{minted}
6907 % \iffalse
6908 %</example>
6909 % \fi
6910 %
6911 % PDF output:---
6912 % \medskip
6913 %
6914 % \needspace{7\baselineskip}
6915 % \resetlinenumber
6916 % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
6917 % \begin{specimen}
6918 % On textual criticism, see \cite[207--241]{ReynoldsWilson1991}.
6919 % \end{specimen}
6920 % \end{alignment}
6921 %
6922 % \medskip
6923 % \texttt{TEI xml} output narrowed down to the contents of the |<text>|
6924 % element:---
6925 %
6926 % \iffalse
6927 %<*example>
6928 % \fi
6929 \begin{minted}[linenos=false]{xml}
6930 <text>
6931 <body>
6932 <p>On textual criticism, see
6933 <bibl corresp="#ReynoldsWilson1991">
6934 <biblScope>207--241</biblScope>
6935 </bibl>.</p>
6936 </body>
6937 <back>
6938 <listBibl>
6939 <biblStruct type="book" xml:id="ReynoldsWilson1991">
6940 <monogr>
6941 <title level="m">Scribes and Scholars</title>
6942 <author>
6943 <forename>L. D.</forename>
6944 <surname>Reynolds</surname>
6945 </author>
6946 <author>
6947 <forename>N. G.</forename>
6948 <surname>Wilson</surname>
6949 </author>
6950 <edition>3</edition>
6951 <imprint>
6952 <pubPlace>Oxford</pubPlace>
6953 <publisher>Clarendon Press</publisher>
6954 <date>1991</date>
6955 </imprint>
6956 </monogr>
6957 </biblStruct>
6958 </listBibl>
6959 </back>
6960 </text>
6961 \end{minted}
6962 % \iffalse
6963 %</example>
6964 % \fi
6965 %
6966 % At the time of writing, the following citation commands are
6967 % converted into \texttt{TEI xml} by \pkg{ekdosis}:---
6968 % \begin{enumerate}
6969 % \item
6970 % \cs{icite}\oarg{prenote}\oarg{postnote}\marg{key}\footnote{From the
6971 % \pkg{icite} package. \cs{icite} can be used in place of almost any
6972 % standard citation command. See \cite{icite}.}
6973 % \item \cs{cite}\oarg{prenote}\oarg{postnote}\marg{key}
6974 % \item \cs{Cite}\oarg{prenote}\oarg{postnote}\marg{key}
6975 % \item \cs{cite*}\oarg{prenote}\oarg{postnote}\marg{key}
6976 % \item \cs{parencite}\oarg{prenote}\oarg{postnote}\marg{key}
6977 % \item \cs{Parencite}\oarg{prenote}\oarg{postnote}\marg{key}
6978 % \item \cs{parencite*}\oarg{prenote}\oarg{postnote}\marg{key}
6979 % \item \cs{footcite}\oarg{prenote}\oarg{postnote}\marg{key}
6980 % \item \cs{footcitetext}\oarg{prenote}\oarg{postnote}\marg{key}
6981 % \item \cs{textcite}\oarg{prenote}\oarg{postnote}\marg{key}
6982 % \item \cs{Textcite}\oarg{prenote}\oarg{postnote}\marg{key}
6983 % \item \cs{smartcite}\oarg{prenote}\oarg{postnote}\marg{key}
6984 % \item \cs{Smartcite}\oarg{prenote}\oarg{postnote}\marg{key}
6985 % \item \cs{autocite}\oarg{prenote}\oarg{postnote}\marg{key}
6986 % \item \cs{Autocite}\oarg{prenote}\oarg{postnote}\marg{key}
6987 % \item \cs{autocite*}\oarg{prenote}\oarg{postnote}\marg{key}
6988 % \item \cs{Autocite*}\oarg{prenote}\oarg{postnote}\marg{key}
6989 % \end{enumerate}
6990 %
6991 % The next release of \pkg{ekdosis} will include all citation commands
6992 % with the exception of so-called \enquote{qualified citation lists}.
6993 %
6994 % \section{Future Work}
6995 % \label{sec:future-work}
6996 % A short, un-commented list of what is planned in the versions of
6997 % \pkg{ekdosis} to come follows:---
6998 % \begin{enumerate}
6999 % \item Very short-term (weeks):---
7000 % \begin{enumerate}
7001 % \item Text structure: milestone elements.
7002 % \item Marginal edition texts: It may happen that the marginalia of
7003 % manuscripts contain texts worth editing in addition to and along
7004 % the main text to which they are linked by reference signs.
7005 % \end{enumerate}
7006 % \item Short-term (months):---
7007 % \begin{enumerate}
7008 % \item Poetry: \pkg{ekdosis} is now able to load and use the
7009 % facilities provided by the \pkg{verse} package. Refined options
7010 % will be added, such as metrical analysis. Arabic poetry through
7011 % the environments and commands provided by the \pkg{arabluatex}
7012 % package will also be supported. Other packages will also be
7013 % considered for inclusion, such as \pkg{poetry} or
7014 % \pkg{teubner}. In the end, \pkg{ekdosis} will provide a way for
7015 % the typesetting of poetry which will allow for more flexibility
7016 % and compatibility with \texttt{TEI xml}.
7017 % \item Correspondence and alignment, segmentation: The functions
7018 % are being tested at the time of writing and will be included in
7019 % \pkg{ekdosis}.
7020 % \end{enumerate}
7021 % \item Medium-term: Indexing, commands and environments for specific
7022 % modules of the \texttt{TEI}.
7023 % \end{enumerate}
7024 %
7025 % \begin{comment}
7026 % \section{Correspondence and Alignment}
7027 % \end{comment}
7028 % \label{sec:correspondence-alignment}
7029 %
7030 % \label{ref:segmentation}
7031 %
7032 % \section{GNU Free Documentation License}
7033 % \label{sec:fdl}
7034 % \textbf{Version 1.3, 3 November 2008}
7035 %
7036 % \begin{center}
7037 % Version 1.3, 3 November 2008
7038 %
7039 % Copyright \copyright{} 2000, 2001, 2002, 2007, 2008 Free
7040 % Software Foundation, Inc.
7041 %
7042 % \bigskip
7043 %
7044 % \url{https://fsf.org/}
7045 %
7046 % \bigskip
7047 %
7048 % Everyone is permitted to copy and distribute verbatim copies
7049 % of this license document, but changing it is not allowed.
7050 % \end{center}
7051 %
7052 % \needspace{3\baselineskip}
7053 % \begin{center}
7054 % {\bf\large Preamble}
7055 % \end{center}
7056 %
7057 % The purpose of this License is to make a manual, textbook, or other
7058 % functional and useful document \enquote{free} in the sense of
7059 % freedom: to assure everyone the effective freedom to copy and
7060 % redistribute it, with or without modifying it, either commercially
7061 % or noncommercially. Secondarily, this License preserves for the
7062 % author and publisher a way to get credit for their work, while not
7063 % being considered responsible for modifications made by others.
7064 %
7065 % This License is a kind of \enquote{copyleft}, which means that
7066 % derivative works of the document must themselves be free in the same
7067 % sense. It complements the GNU General Public License, which is a
7068 % copyleft license designed for free software.
7069 %
7070 % We have designed this License in order to use it for manuals for
7071 % free software, because free software needs free documentation: a
7072 % free program should come with manuals providing the same freedoms
7073 % that the software does. But this License is not limited to software
7074 % manuals; it can be used for any textual work, regardless of subject
7075 % matter or whether it is published as a printed book. We recommend
7076 % this License principally for works whose purpose is instruction or
7077 % reference.
7078 %
7079 % \needspace{3\baselineskip}
7080 % \begin{center}
7081 % {\large\bf 1. APPLICABILITY AND DEFINITIONS\par}
7082 % \end{center}
7083 %
7084 % This License applies to any manual or other work, in any medium,
7085 % that contains a notice placed by the copyright holder saying it can
7086 % be distributed under the terms of this License. Such a notice
7087 % grants a world-wide, royalty-free license, unlimited in duration, to
7088 % use that work under the conditions stated herein. The
7089 % \enquote{\textbf{Document}}, below, refers to any such manual or
7090 % work. Any member of the public is a licensee, and is addressed as
7091 % \enquote{\textbf{you}}. You accept the license if you copy, modify
7092 % or distribute the work in a way requiring permission under copyright
7093 % law.
7094 %
7095 % A \enquote{\textbf{Modified Version}} of the Document means any work
7096 % containing the Document or a portion of it, either copied verbatim,
7097 % or with modifications and/or translated into another language.
7098 %
7099 % A \enquote{\textbf{Secondary Section}} is a named appendix or a
7100 % front-matter section of the Document that deals exclusively with the
7101 % relationship of the publishers or authors of the Document to the
7102 % Document's overall subject (or to related matters) and contains
7103 % nothing that could fall directly within that overall subject.
7104 % (Thus, if the Document is in part a textbook of mathematics, a
7105 % Secondary Section may not explain any mathematics.) The
7106 % relationship could be a matter of historical connection with the
7107 % subject or with related matters, or of legal, commercial,
7108 % philosophical, ethical or political position regarding them.
7109 %
7110 % The \enquote{\textbf{Invariant Sections}} are certain Secondary
7111 % Sections whose titles are designated, as being those of Invariant
7112 % Sections, in the notice that says that the Document is released
7113 % under this License. If a section does not fit the above definition
7114 % of Secondary then it is not allowed to be designated as Invariant.
7115 % The Document may contain zero Invariant Sections. If the Document
7116 % does not identify any Invariant Sections then there are none.
7117 %
7118 % The \enquote{\textbf{Cover Texts}} are certain short passages of
7119 % text that are listed, as Front-Cover Texts or Back-Cover Texts, in
7120 % the notice that says that the Document is released under this
7121 % License. A Front-Cover Text may be at most 5 words, and a
7122 % Back-Cover Text may be at most 25 words.
7123 %
7124 % A \enquote{\textbf{Transparent}} copy of the Document means a
7125 % machine-readable copy, represented in a format whose specification
7126 % is available to the general public, that is suitable for revising
7127 % the document straightforwardly with generic text editors or (for
7128 % images composed of pixels) generic paint programs or (for drawings)
7129 % some widely available drawing editor, and that is suitable for input
7130 % to text formatters or for automatic translation to a variety of
7131 % formats suitable for input to text formatters. A copy made in an
7132 % otherwise Transparent file format whose markup, or absence of
7133 % markup, has been arranged to thwart or discourage subsequent
7134 % modification by readers is not Transparent. An image format is not
7135 % Transparent if used for any substantial amount of text. A copy that
7136 % is not \enquote{Transparent} is called \enquote{\textbf{Opaque}}.
7137 %
7138 % Examples of suitable formats for Transparent copies include plain
7139 % ASCII without markup, Texinfo input format, LaTeX input format, SGML
7140 % or XML using a publicly available DTD, and standard-conforming
7141 % simple HTML, PostScript or PDF designed for human modification.
7142 % Examples of transparent image formats include PNG, XCF and JPG.
7143 % Opaque formats include proprietary formats that can be read and
7144 % edited only by proprietary word processors, SGML or XML for which
7145 % the DTD and/or processing tools are not generally available, and the
7146 % machine-generated HTML, PostScript or PDF produced by some word
7147 % processors for output purposes only.
7148 %
7149 % The \enquote{\textbf{Title Page}} means, for a printed book, the
7150 % title page itself, plus such following pages as are needed to hold,
7151 % legibly, the material this License requires to appear in the title
7152 % page. For works in formats which do not have any title page as
7153 % such, \enquote{Title Page} means the text near the most prominent
7154 % appearance of the work's title, preceding the beginning of the body
7155 % of the text.
7156 %
7157 % The \enquote{\textbf{publisher}} means any person or entity that
7158 % distributes copies of the Document to the public.
7159 %
7160 % A section \enquote{\textbf{Entitled XYZ}} means a named subunit of
7161 % the Document whose title either is precisely XYZ or contains XYZ in
7162 % parentheses following text that translates XYZ in another language.
7163 % (Here XYZ stands for a specific section name mentioned below, such
7164 % as \enquote{\textbf{Acknowledgements}},
7165 % \enquote{\textbf{Dedications}}, \enquote{\textbf{Endorsements}}, or
7166 % \enquote{\textbf{History}}.) To \enquote{\textbf{Preserve the
7167 % Title}} of such a section when you modify the Document means that it
7168 % remains a section \enquote{Entitled XYZ} according to this
7169 % definition.
7170 %
7171 % The Document may include Warranty Disclaimers next to the notice
7172 % which states that this License applies to the Document. These
7173 % Warranty Disclaimers are considered to be included by reference in
7174 % this License, but only as regards disclaiming warranties: any other
7175 % implication that these Warranty Disclaimers may have is void and has
7176 % no effect on the meaning of this License.
7177 %
7178 % \needspace{3\baselineskip}
7179 % \begin{center}
7180 % {\large\bf 2. VERBATIM COPYING\par}
7181 % \end{center}
7182 %
7183 % You may copy and distribute the Document in any medium, either
7184 % commercially or noncommercially, provided that this License, the
7185 % copyright notices, and the license notice saying this License
7186 % applies to the Document are reproduced in all copies, and that you
7187 % add no other conditions whatsoever to those of this License. You
7188 % may not use technical measures to obstruct or control the reading or
7189 % further copying of the copies you make or distribute. However, you
7190 % may accept compensation in exchange for copies. If you distribute a
7191 % large enough number of copies you must also follow the conditions in
7192 % section~3.
7193 %
7194 % You may also lend copies, under the same conditions stated above,
7195 % and you may publicly display copies.
7196 %
7197 % \needspace{3\baselineskip}
7198 % \begin{center}
7199 % {\large\bf 3. COPYING IN QUANTITY\par}
7200 % \end{center}
7201 %
7202 % If you publish printed copies (or copies in media that commonly have
7203 % printed covers) of the Document, numbering more than 100, and the
7204 % Document's license notice requires Cover Texts, you must enclose the
7205 % copies in covers that carry, clearly and legibly, all these Cover
7206 % Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
7207 % the back cover. Both covers must also clearly and legibly identify
7208 % you as the publisher of these copies. The front cover must present
7209 % the full title with all words of the title equally prominent and
7210 % visible. You may add other material on the covers in addition.
7211 % Copying with changes limited to the covers, as long as they preserve
7212 % the title of the Document and satisfy these conditions, can be
7213 % treated as verbatim copying in other respects.
7214 %
7215 % If the required texts for either cover are too voluminous to fit
7216 % legibly, you should put the first ones listed (as many as fit
7217 % reasonably) on the actual cover, and continue the rest onto adjacent
7218 % pages.
7219 %
7220 % If you publish or distribute Opaque copies of the Document numbering
7221 % more than 100, you must either include a machine-readable
7222 % Transparent copy along with each Opaque copy, or state in or with
7223 % each Opaque copy a computer-network location from which the general
7224 % network-using public has access to download using public-standard
7225 % network protocols a complete Transparent copy of the Document, free
7226 % of added material. If you use the latter option, you must take
7227 % reasonably prudent steps, when you begin distribution of Opaque
7228 % copies in quantity, to ensure that this Transparent copy will remain
7229 % thus accessible at the stated location until at least one year after
7230 % the last time you distribute an Opaque copy (directly or through
7231 % your agents or retailers) of that edition to the public.
7232 %
7233 % It is requested, but not required, that you contact the authors of
7234 % the Document well before redistributing any large number of copies,
7235 % to give them a chance to provide you with an updated version of the
7236 % Document.
7237 %
7238 % \needspace{3\baselineskip}
7239 % \begin{center}
7240 % {\large\bf 4. MODIFICATIONS\par}
7241 % \end{center}
7242 %
7243 % You may copy and distribute a Modified Version of the Document under
7244 % the conditions of sections 2 and 3 above, provided that you release
7245 % the Modified Version under precisely this License, with the Modified
7246 % Version filling the role of the Document, thus licensing
7247 % distribution and modification of the Modified Version to whoever
7248 % possesses a copy of it. In addition, you must do these things in
7249 % the Modified Version:
7250 %
7251 % \begin{itemize}
7252 % \item[A.] Use in the Title Page (and on the covers, if any) a title
7253 % distinct from that of the Document, and from those of previous
7254 % versions (which should, if there were any, be listed in the
7255 % History section of the Document). You may use the same title as a
7256 % previous version if the original publisher of that version gives
7257 % permission.
7258 %
7259 % \item[B.] List on the Title Page, as authors, one or more persons
7260 % or entities responsible for authorship of the modifications in
7261 % the Modified Version, together with at least five of the
7262 % principal authors of the Document (all of its principal authors,
7263 % if it has fewer than five), unless they release you from this
7264 % requirement.
7265 %
7266 % \item[C.] State on the Title page the name of the publisher of the
7267 % Modified Version, as the publisher.
7268 %
7269 % \item[D.] Preserve all the copyright notices of the Document.
7270 %
7271 % \item[E.] Add an appropriate copyright notice for your
7272 % modifications adjacent to the other copyright notices.
7273 %
7274 % \item[F.] Include, immediately after the copyright notices, a
7275 % license notice giving the public permission to use the Modified
7276 % Version under the terms of this License, in the form shown in the
7277 % Addendum below.
7278 %
7279 % \item[G.] Preserve in that license notice the full lists of
7280 % Invariant Sections and required Cover Texts given in the
7281 % Document's license notice.
7282 %
7283 % \item[H.] Include an unaltered copy of this License.
7284 %
7285 % \item[I.] Preserve the section Entitled \enquote{History},
7286 % Preserve its Title, and add to it an item stating at least the
7287 % title, year, new authors, and publisher of the Modified Version
7288 % as given on the Title Page. If there is no section Entitled
7289 % \enquote{History} in the Document, create one stating the title,
7290 % year, authors, and publisher of the Document as given on its
7291 % Title Page, then add an item describing the Modified Version as
7292 % stated in the previous sentence.
7293 %
7294 % \item[J.] Preserve the network location, if any, given in the
7295 % Document for public access to a Transparent copy of the Document,
7296 % and likewise the network locations given in the Document for
7297 % previous versions it was based on. These may be placed in the
7298 % \enquote{History} section. You may omit a network location for a
7299 % work that was published at least four years before the Document
7300 % itself, or if the original publisher of the version it refers to
7301 % gives permission.
7302 %
7303 % \item[K.] For any section Entitled \enquote{Acknowledgements} or
7304 % \enquote{Dedications}, Preserve the Title of the section, and
7305 % preserve in the section all the substance and tone of each of the
7306 % contributor acknowledgements and/or dedications given therein.
7307 %
7308 % \item[L.] Preserve all the Invariant Sections of the Document,
7309 % unaltered in their text and in their titles. Section numbers or
7310 % the equivalent are not considered part of the section titles.
7311 %
7312 % \item[M.] Delete any section Entitled \enquote{Endorsements}.
7313 % Such a section may not be included in the Modified Version.
7314 %
7315 % \item[N.] Do not retitle any existing section to be Entitled
7316 % \enquote{Endorsements} or to conflict in title with any Invariant
7317 % Section.
7318 %
7319 % \item[O.] Preserve any Warranty Disclaimers.
7320 % \end{itemize}
7321 %
7322 % If the Modified Version includes new front-matter sections or
7323 % appendices that qualify as Secondary Sections and contain no
7324 % material copied from the Document, you may at your option designate
7325 % some or all of these sections as invariant. To do this, add their
7326 % titles to the list of Invariant Sections in the Modified Version's
7327 % license notice. These titles must be distinct from any other
7328 % section titles.
7329 %
7330 % You may add a section Entitled \enquote{Endorsements}, provided it
7331 % contains nothing but endorsements of your Modified Version by
7332 % various parties---for example, statements of peer review or that the
7333 % text has been approved by an organization as the authoritative
7334 % definition of a standard.
7335 %
7336 % You may add a passage of up to five words as a Front-Cover Text, and
7337 % a passage of up to 25 words as a Back-Cover Text, to the end of the
7338 % list of Cover Texts in the Modified Version. Only one passage of
7339 % Front-Cover Text and one of Back-Cover Text may be added by (or
7340 % through arrangements made by) any one entity. If the Document
7341 % already includes a cover text for the same cover, previously added
7342 % by you or by arrangement made by the same entity you are acting on
7343 % behalf of, you may not add another; but you may replace the old one,
7344 % on explicit permission from the previous publisher that added the
7345 % old one.
7346 %
7347 % The author(s) and publisher(s) of the Document do not by this
7348 % License give permission to use their names for publicity for or to
7349 % assert or imply endorsement of any Modified Version.
7350 %
7351 % \needspace{3\baselineskip}
7352 % \begin{center}
7353 % {\large\bf 5. COMBINING DOCUMENTS\par}
7354 % \end{center}
7355 %
7356 % You may combine the Document with other documents released under
7357 % this License, under the terms defined in section~4 above for
7358 % modified versions, provided that you include in the combination all
7359 % of the Invariant Sections of all of the original documents,
7360 % unmodified, and list them all as Invariant Sections of your combined
7361 % work in its license notice, and that you preserve all their Warranty
7362 % Disclaimers.
7363 %
7364 % The combined work need only contain one copy of this License, and
7365 % multiple identical Invariant Sections may be replaced with a single
7366 % copy. If there are multiple Invariant Sections with the same name
7367 % but different contents, make the title of each such section unique
7368 % by adding at the end of it, in parentheses, the name of the original
7369 % author or publisher of that section if known, or else a unique
7370 % number. Make the same adjustment to the section titles in the list
7371 % of Invariant Sections in the license notice of the combined work.
7372 %
7373 % In the combination, you must combine any sections Entitled
7374 % \enquote{History} in the various original documents, forming one
7375 % section Entitled \enquote{History}; likewise combine any sections
7376 % Entitled \enquote{Acknowledgements}, and any sections Entitled
7377 % \enquote{Dedications}. You must delete all sections Entitled
7378 % \enquote{Endorsements}.
7379 %
7380 % \needspace{3\baselineskip}
7381 % \begin{center}
7382 % {\large\bf 6. COLLECTIONS OF DOCUMENTS\par}
7383 % \end{center}
7384 %
7385 % You may make a collection consisting of the Document and other
7386 % documents released under this License, and replace the individual
7387 % copies of this License in the various documents with a single copy
7388 % that is included in the collection, provided that you follow the
7389 % rules of this License for verbatim copying of each of the documents
7390 % in all other respects.
7391 %
7392 % You may extract a single document from such a collection, and
7393 % distribute it individually under this License, provided you insert a
7394 % copy of this License into the extracted document, and follow this
7395 % License in all other respects regarding verbatim copying of that
7396 % document.
7397 %
7398 % \needspace{3\baselineskip}
7399 % \begin{center}
7400 % {\large\bf 7. AGGREGATION WITH INDEPENDENT WORKS\par}
7401 % \end{center}
7402 %
7403 % A compilation of the Document or its derivatives with other separate
7404 % and independent documents or works, in or on a volume of a storage
7405 % or distribution medium, is called an \enquote{aggregate} if the
7406 % copyright resulting from the compilation is not used to limit the
7407 % legal rights of the compilation's users beyond what the individual
7408 % works permit. When the Document is included in an aggregate, this
7409 % License does not apply to the other works in the aggregate which are
7410 % not themselves derivative works of the Document.
7411 %
7412 % If the Cover Text requirement of section~3 is applicable to these
7413 % copies of the Document, then if the Document is less than one half
7414 % of the entire aggregate, the Document's Cover Texts may be placed on
7415 % covers that bracket the Document within the aggregate, or the
7416 % electronic equivalent of covers if the Document is in electronic
7417 % form. Otherwise they must appear on printed covers that bracket the
7418 % whole aggregate.
7419 %
7420 % \needspace{3\baselineskip}
7421 % \begin{center}
7422 % {\large\bf 8. TRANSLATION\par}
7423 % \end{center}
7424 %
7425 % Translation is considered a kind of modification, so you may
7426 % distribute translations of the Document under the terms of
7427 % section~4. Replacing Invariant Sections with translations requires
7428 % special permission from their copyright holders, but you may include
7429 % translations of some or all Invariant Sections in addition to the
7430 % original versions of these Invariant Sections. You may include a
7431 % translation of this License, and all the license notices in the
7432 % Document, and any Warranty Disclaimers, provided that you also
7433 % include the original English version of this License and the
7434 % original versions of those notices and disclaimers. In case of a
7435 % disagreement between the translation and the original version of
7436 % this License or a notice or disclaimer, the original version will
7437 % prevail.
7438 %
7439 % If a section in the Document is Entitled \enquote{Acknowledgements},
7440 % \enquote{Dedications}, or \enquote{History}, the requirement
7441 % (section~4) to Preserve its Title (section~1) will typically require
7442 % changing the actual title.
7443 %
7444 % \needspace{3\baselineskip}
7445 % \begin{center}
7446 % {\large\bf 9. TERMINATION\par}
7447 % \end{center}
7448 %
7449 % You may not copy, modify, sublicense, or distribute the Document
7450 % except as expressly provided under this License. Any attempt
7451 % otherwise to copy, modify, sublicense, or distribute it is void, and
7452 % will automatically terminate your rights under this License.
7453 %
7454 % However, if you cease all violation of this License, then your
7455 % license from a particular copyright holder is reinstated (a)
7456 % provisionally, unless and until the copyright holder explicitly and
7457 % finally terminates your license, and (b) permanently, if the
7458 % copyright holder fails to notify you of the violation by some
7459 % reasonable means prior to 60 days after the cessation.
7460 %
7461 % Moreover, your license from a particular copyright holder is
7462 % reinstated permanently if the copyright holder notifies you of the
7463 % violation by some reasonable means, this is the first time you have
7464 % received notice of violation of this License (for any work) from
7465 % that copyright holder, and you cure the violation prior to 30 days
7466 % after your receipt of the notice.
7467 %
7468 % Termination of your rights under this section does not terminate the
7469 % licenses of parties who have received copies or rights from you
7470 % under this License. If your rights have been terminated and not
7471 % permanently reinstated, receipt of a copy of some or all of the same
7472 % material does not give you any rights to use it.
7473 %
7474 % \needspace{3\baselineskip}
7475 % \begin{center}
7476 % {\large\bf 10. FUTURE REVISIONS OF THIS LICENSE\par}
7477 % \end{center}
7478 %
7479 % The Free Software Foundation may publish new, revised versions of
7480 % the GNU Free Documentation License from time to time. Such new
7481 % versions will be similar in spirit to the present version, but may
7482 % differ in detail to address new problems or concerns. See
7483 % \url{https://www.gnu.org/licenses/}.
7484 %
7485 % Each version of the License is given a distinguishing version
7486 % number. If the Document specifies that a particular numbered
7487 % version of this License \enquote{or any later version} applies to
7488 % it, you have the option of following the terms and conditions either
7489 % of that specified version or of any later version that has been
7490 % published (not as a draft) by the Free Software Foundation. If the
7491 % Document does not specify a version number of this License, you may
7492 % choose any version ever published (not as a draft) by the Free
7493 % Software Foundation. If the Document specifies that a proxy can
7494 % decide which future versions of this License can be used, that
7495 % proxy's public statement of acceptance of a version permanently
7496 % authorizes you to choose that version for the Document.
7497 %
7498 % \needspace{3\baselineskip}
7499 % \begin{center}
7500 % {\large\bf 11. RELICENSING\par}
7501 % \end{center}
7502 %
7503 % \enquote{Massive Multiauthor Collaboration Site} (or \enquote{MMC
7504 % Site}) means any World Wide Web server that publishes copyrightable
7505 % works and also provides prominent facilities for anybody to edit
7506 % those works. A public wiki that anybody can edit is an example of
7507 % such a server. A \enquote{Massive Multiauthor Collaboration} (or
7508 % \enquote{MMC}) contained in the site means any set of copyrightable
7509 % works thus published on the MMC site.
7510 %
7511 % \enquote{CC-BY-SA} means the Creative Commons Attribution-Share
7512 % Alike 3.0 license published by Creative Commons Corporation, a
7513 % not-for-profit corporation with a principal place of business in San
7514 % Francisco, California, as well as future copyleft versions of that
7515 % license published by that same organization.
7516 %
7517 % \enquote{Incorporate} means to publish or republish a Document, in
7518 % whole or in part, as part of another Document.
7519 %
7520 % An MMC is \enquote{eligible for relicensing} if it is licensed under
7521 % this License, and if all works that were first published under this
7522 % License somewhere other than this MMC, and subsequently incorporated
7523 % in whole or in part into the MMC, (1) had no cover texts or
7524 % invariant sections, and (2) were thus incorporated prior to November
7525 % 1, 2008.
7526 %
7527 % The operator of an MMC Site may republish an MMC contained in the
7528 % site under CC-BY-SA on the same site at any time before August 1,
7529 % 2009, provided the MMC is eligible for relicensing.
7530 %
7531 % \needspace{3\baselineskip}
7532 % \begin{center}
7533 % {\large\bf ADDENDUM: How to use this License for your documents\par}
7534 % \end{center}
7535 %
7536 % To use this License in a document you have written, include a copy
7537 % of the License in the document and put the following copyright and
7538 % license notices just after the title page:
7539 %
7540 % \bigskip
7541 % \begin{quote}
7542 % Copyright \copyright{} YEAR YOUR NAME. Permission is granted to
7543 % copy, distribute and/or modify this document under the terms of
7544 % the GNU Free Documentation License, Version 1.3 or any later
7545 % version published by the Free Software Foundation; with no
7546 % Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
7547 % A copy of the license is included in the section entitled
7548 % \enquote{GNU Free Documentation License}.
7549 % \end{quote}
7550 % \bigskip
7551 %
7552 % If you have Invariant Sections, Front-Cover Texts and Back-Cover
7553 % Texts, replace the \enquote{with \dots\ Texts.}\ line with this:
7554 %
7555 % \bigskip
7556 % \begin{quote}
7557 % with the Invariant Sections being LIST THEIR TITLES, with the
7558 % Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
7559 % \end{quote}
7560 % \bigskip
7561 %
7562 % If you have Invariant Sections without Cover Texts, or some other
7563 % combination of the three, merge those two alternatives to suit the
7564 % situation.
7565 %
7566 % If your document contains nontrivial examples of program code, we
7567 % recommend releasing these examples in parallel under your choice of
7568 % free software license, such as the GNU General Public License,
7569 % to permit their use in free software.
7570 %
7571 % \section{References}
7572 % \label{sec:references}
7573 % \printbibliography[heading=none]
7574 %
7575 % \section{Sample: C. J. Caesar, \emph{Gallic War},
7576 % VI, XIII.1}
7577 % \label{sec:caesar-gw-6-1-13}
7578 % \subsection{\texttt{.tex} Source File}
7579 % \label{sec:caesar-gw-tex}
7580 % \inputminted[linenos=true]{latex}{samples/Caesar_BG-6-13-1.tex}
7581 % \subsection{\texttt{TEI xml} Output}
7582 % \label{sec:caesar-gw-tei}
7583 % \inputminted[linenos=true]{xml}{samples/Caesar_BG-6-13-1-tei.xml}
7584 %
7585 % \section{Arabic Sample File}
7586 % \label{sec:arabic-sample}
7587 % |arabic-sample.tex|:---
7588 % \iffalse
7589 %<*example>
7590 % \fi
7591 \begin{minted}[linenos=false]{latex}
7592 % Instructions:
7593 % 1. Compile this file three times.
7594 % - Open arabic-sample.pdf and arabic-sample-tei.xml and see the
7595 % result.
7596 % 2. Compile arabic-sample_out.tex three times.
7597 % - Open arabic-sample_out.pdf and arabic-sample-out-tei.xml and
7598 % see the result.
7599 %
7600 \documentclass{article}
7601
7602 % The following three lines are only needed by the
7603 % 'arabic-sample_out.tex' that arabluatex is instructed to produce:
7604 \usepackage{babel}
7605 \babelprovide[onchar=fonts]{arabic}
7606 \babelfont[*arabic]{rm}{Amiri}
7607
7608 % instruct ekdosis to output TEI xml (arabic-sample-tei.xml):
7609 \usepackage[teiexport=tidy]{ekdosis}
7610
7611 % instruct arabluatex to output sample-arabic_out.tex with Unicode
7612 % Arabic strings in place of arabtex ASCII scheme:
7613 \usepackage[fullvoc,export]{arabluatex}
7614
7615 \begin{document}
7616
7617 \begin{arabexport} % export arabtex strings to Unicode Arabic
7618 \begin{ekdosis}
7619 \begin{arab}
7620 'inna 'abI kAna mina
7621 \app{
7622 \lem{'l-muqAtilaTi}
7623 \rdg{'l-muqAtilIna}
7624 }
7625 wa-kAnat 'ummI min `u.zamA'i buyUti 'l-zamAzimaTi.
7626 \end{arab}
7627 \end{ekdosis}
7628 \end{arabexport}
7629 \end{document}
7630 \end{minted}
7631 % \iffalse
7632 %</example>
7633 % \fi
7634 %
7635 % \StopEventually{}
7636 %
7637 % \section{Implementation}
7638 % \label{sec:implementation}
7639 %
7640 % \iffalse
7641 %<*package>
7642 % \fi
7643 %
7644 % \pkg{ekdosis} relies on Lua functions and tables. Read the
7645 % |.lua| files that accompany \pkg{ekdosis} for more
7646 % information.
7647 % \begin{macrocode}
7648 \RequirePackage{iftex}
7649 % \end{macrocode}
7650 % Of course, \pkg{ekdosis} requires {\LuaLaTeX}. Issue an error
7651 % if the document is processed with another engine.
7652 % \begin{macrocode}
7653 \RequireLuaTeX
7654 % \end{macrocode}
7655 % Set global options:---
7656 % \begin{macrocode}
7657 \RequirePackage{expkv-opt}
7658 \RequirePackage{expkv-def}
7659 \newif\if@pkg@float
7660 \newif\if@pkg@footins
7661 \newif\if@pkg@keyfloat
7662 \newif\if@pkg@fitapp
7663 \newif\if@pkg@ekddivs
7664 \newif\if@parnotesroman
7665 \newif\if@pkg@parnotes
7666 \newif\iftei@export
7667 \newif\if@pkg@poetry@verse
7668 \ekvdefinekeys{ekdosis}{
7669 choice layout = {float = {\@pkg@floattrue},
7670 footins = {\@pkg@floatfalse\@pkg@footinstrue},
7671 keyfloat = {\@pkg@floatfalse\@pkg@keyfloattrue},
7672 fitapp = {\@pkg@floatfalse\@pkg@fitapptrue}},
7673 initial layout = float,
7674 unknown-choice layout = \PackageError{ekdosis}{unknown
7675 layout=#1}{`layout' must be either `float' or `footins'.},
7676 choice divs = {ekdosis = {\@pkg@ekddivstrue},
7677 latex = {\@pkg@ekddivsfalse
7678 \AtBeginDocument{\luadirect{ekdosis.setekddivsfalse()}}}},
7679 initial divs = ekdosis,
7680 unknown-choice divs = \PackageError{ekdosis}{unknown divs=#1}{`divs'
7681 must be either `ekdosis' or `latex'.},
7682 choice poetry = {verse = {\@pkg@poetry@versetrue}},
7683 unknown-choice poetry = \PackageError{ekdosis}{unknown
7684 poetry=#1}{`poetry' must be `verse' for now.},
7685 choice parnotes = {false = {},
7686 true = {\@pkg@parnotestrue},
7687 roman = {\@pkg@parnotestrue\@parnotesromantrue}},
7688 default parnotes = true,
7689 unknown-choice parnotes = \PackageError{ekdosis}{unknown
7690 parnotes=#1}{`parnotes' must be either `true', or `false' or
7691 `roman'.},
7692 choice teiexport = {false = {},
7693 true = {\tei@exporttrue
7694 \AtBeginDocument{\luadirect{ekdosis.openteistream()}}%
7695 \AtEndDocument{\luadirect{ekdosis.closeteistream()}}},
7696 tidy = {\tei@exporttrue
7697 \AtBeginDocument{\luadirect{ekdosis.openteistream()}}%
7698 \AtEndDocument{\luadirect{ekdosis.closeteistream("tidy")}}}},
7699 default teiexport = true,
7700 unknown-choice teiexport = \PackageError{ekdosis}{unknown
7701 teiexport=#1}{`teiexport' must be either `true', `false' or
7702 `tidy'.}
7703 }
7704 \ekvoProcessLocalOptions{ekdosis}
7705 \newif\ifekd@memoir@loaded
7706 \@ifclassloaded{memoir}{%
7707 \ekd@memoir@loadedtrue\@pkg@poetry@versetrue}{}
7708 % \end{macrocode}
7709 % \paragraph{Required Packages} \label{ref:ekdrequirements} In
7710 % addition to \pkg{iftex}, \pkg{expkv-opt} and \pkg{expkv-def}, a list
7711 % of the packages that are required by \pkg{ekdosis} follows:---
7712 % \begin{macrocode}
7713 % \RequirePackage{iftex} % already loaded above
7714 % \RequirePackage{expkv-opt} % already loaded above
7715 % \RequirePackage{expkv-def} % already loaded above
7716 \RequirePackage{luacode}
7717 \RequirePackage{paracol}
7718 \RequirePackage{etoolbox}
7719 \RequirePackage{lineno}
7720 \if@pkg@float
7721 \RequirePackage{trivfloat}
7722 \trivfloat{ekdapparatus}
7723 \fi
7724 \if@pkg@keyfloat
7725 \RequirePackage{keyfloat}
7726 \def\ekd@keyparopts#1{%
7727 \def\ekd@insert@keyparapp{%
7728 \keyparbox[!b]{#1}{\ekd@insert@apparatus}}}
7729 \ekd@keyparopts{}
7730 \fi
7731 \if@pkg@fitapp
7732 \RequirePackage{tcolorbox}
7733 \tcbuselibrary{fitting,skins}
7734 \fi
7735 \RequirePackage{refcount}
7736 \RequirePackage{zref-user}
7737 \RequirePackage{zref-abspage}
7738 \RequirePackage{ltxcmds}
7739 \RequirePackage{pdftexcmds}
7740 \RequirePackage{ifoddpage}
7741 \if@pkg@poetry@verse
7742 \RequirePackage{verse}
7743 \fi
7744 \if@pkg@parnotes
7745 \RequirePackage{parnotes}
7746 \fi
7747 % \end{macrocode}
7748 % \paragraph{Lua} Here begins the real work: load |ekdosis.lua|:---
7749 % \begin{macrocode}
7750 \luadirect{dofile(kpse.find_file("ekdosis.lua"))}
7751 % \end{macrocode}
7752 % \begin{macrocode}
7753 \AtEndDocument{
7754 \luadirect{ekdosis.closestream()}
7755 }
7756 % \end{macrocode}
7757 % \paragraph{Setup}
7758 % \begin{macro}{\ekdsetup}
7759 % \changes{v1.3}{2021/08/18}{new command for global options}
7760 % \cs{ekdsetup} is used to specify options that affect the general
7761 % behavior of \pkg{ekdosis}. It is a preamble-only command.
7762 % \begin{macrocode}
7763 \ekvdefinekeys{ekd@setup}{
7764 bool showpagebreaks = \ifekd@showpb,
7765 store spbmk = \ekd@spbmk,
7766 initial spbmk = spb,
7767 store hpbmk = \ekd@hpbmk,
7768 initial hpbmk = hpb,
7769 }
7770 \NewDocumentCommand{\ekdsetup}{m}{\ekvset{ekd@setup}{#1}}
7771 \@onlypreamble\ekdsetup
7772 % \end{macrocode}
7773 % \end{macro}
7774 % \begin{macro}{\SetHooks} \cs{SetHooks} is used to set
7775 % hooks meant to be shared by all declared apparatuses, such as the
7776 % font size, the format of numerals, \emph{\&c.} This command can be
7777 % used in the preamble or at any point of the document.
7778 % \changes{v1.2}{2021/04/02}{general hooks: new option
7779 % \texttt{lemmastyle}}
7780 % \changes{v1.2}{2021/04/02}{general hooks: new option
7781 % \texttt{readingstyle}}
7782 % \changes{v1.3}{2021/08/18}{general hooks: new options
7783 % \texttt{keyparopts} and \texttt{appheight}}
7784 % \begin{macrocode}
7785 \ekvdefinekeys{ekd@hooks}{
7786 store appfontsize = \ekd@appfontsize,
7787 store refnumstyle = \ekd@refnumstyle,
7788 store postrefnum = \ekd@postrefnum,
7789 code familysep = \luadirect{ekdosis.setfamilysep(\luastringN{#1})},
7790 store lemmastyle = \ekd@lemmastyle,
7791 store readingstyle = \ekd@readingstyle,
7792 code keyparopts = \if@pkg@keyfloat\ekd@keyparopts{#1}\fi,
7793 dimen appheight = \ekd@app@height,
7794 initial appheight = .5\textheight,
7795 choice fitalgorithm = {fontsize = \def\ekd@fit@algorithm{fontsize},
7796 hybrid = \def\ekd@fit@algorithm{hybrid},
7797 areasize = \def\ekd@fit@algorithm{areasize},
7798 squeeze = \def\ekd@fit@algorithm{squeeze}},
7799 initial fitalgorithm = fontsize,
7800 unknown-choice fitalgorithm = \PackageError{ekdosis}{unknown
7801 fitalgorithm=#1}{`fitalgorithm' must be either `fontsize',
7802 `hybrid', `areasize' or `squeeze'.},
7803 code initialrule = \def\ekd@initial@rule{#1\NLS},
7804 default initialrule = \rule{0.4\columnwidth}{0.4pt},
7805 noval noinitialrule = \undef\ekd@initial@rule,
7806 initial appfontsize = \footnotesize,
7807 initial refnumstyle = \bfseries,
7808 initial postrefnum = ~,
7809 initial lemmastyle = {},
7810 initial readingstyle = {}
7811 }
7812 \NewDocumentCommand{\SetHooks}{m}{\ekvset{ekd@hooks}{#1}}
7813 % \end{macrocode}
7814 % \end{macro}
7815 % Build and process the list of witnesses and hands:---
7816 % \begin{macrocode}
7817 \ekvdefinekeys{ekd@witness}{
7818 store settlement = \settlement@value,
7819 store institution = \institution@value,
7820 store repository = \repository@value,
7821 store collection = \collection@value,
7822 store idno = \idno@value,
7823 store msName = \msName@value,
7824 store origDate = \origDate@value,
7825 store locus = \locus@value
7826 }
7827 % \end{macrocode}
7828 % \begin{macro}{\DeclareWitness} \cs{DeclareWitness} is a
7829 % preamble-only command. It takes three mandatory arguments and one
7830 % optional argument. It is meant to collect data related to
7831 % witnesses to be used in the edition text. Data are stored in |Lua|
7832 % tables and are used to encode the |<listWit>| part of the |TEI|
7833 % header as well as the Conspectus Siglorum in the edition in print.
7834 % \begin{macrocode}
7835 \NewDocumentCommand{\DeclareWitness}{m m m O{}}{%
7836 \bgroup
7837 \ekvset{ekd@witness}{#4}
7838 \luadirect{ekdosis.newwitness(
7839 \luastringN{#1},
7840 \luastringN{#2},
7841 \luastringN{#3},
7842 \luastringO{\settlement@value},
7843 \luastringO{\institution@value},
7844 \luastringO{\repository@value},
7845 \luastringO{\collection@value},
7846 \luastringO{\idno@value},
7847 \luastringO{\msName@value},
7848 \luastringO{\origDate@value},
7849 \luastringO{\locus@value})}
7850 \egroup
7851 }
7852 \@onlypreamble\DeclareWitness
7853 % \end{macrocode}
7854 % \end{macro}
7855 % \begin{macro}{\DeclareHand} As \cs{DeclareWitness}, \cs{DeclareHand}
7856 % is a preamble-only command meant to collect data and store them in
7857 % |Lua| tables. It takes three mandatory arguments and one optional
7858 % argument. The second argument is used to connect the hand to a
7859 % declared witness it is related to. Then the table in which this
7860 % witness is recorded can be fed with new data.
7861 % \begin{macrocode}
7862 \NewDocumentCommand{\DeclareHand}{m m m +O{}}{
7863 \luadirect{ekdosis.newhand(\luastringN{#1},
7864 \luastringN{#2},
7865 \luastringN{#3},
7866 \luastringN{#4})}
7867 }
7868 \@onlypreamble\DeclareHand
7869 % \end{macrocode}
7870 % \end{macro}
7871 % Build and process the list of scholars:---
7872 % \begin{macrocode}
7873 \ekvdefinekeys{ekd@scholar}{
7874 store rawname = \rawname@value,
7875 store forename = \forename@value,
7876 store surname = \surname@value,
7877 store addname = \addname@value,
7878 store note = \note@value
7879 }
7880 % \end{macrocode}
7881 % \begin{macro}{\DeclareScholar}
7882 % \changes{v1.1}{2020/11/04}{nows builds a list of persons}
7883 % \cs{DeclareScholar} is used to build a list of persons within the
7884 % |<listPerson>| element. It takes two mandatory arguments to specify
7885 % consecutively a unique identifier and the rendition to be used in
7886 % the apparatus criticus in print, and one optional argument used to
7887 % collect the name parts components and further items of information
7888 % from |key-value| \enquote*{named} arguments.
7889 % \begin{macrocode}
7890 \NewDocumentCommand{\DeclareScholar}{m m O{}}{%
7891 \bgroup
7892 \ekvset{ekd@scholar}{#3}
7893 \luadirect{ekdosis.newscholar(
7894 \luastringN{#1},
7895 \luastringN{#2},
7896 \luastringO{\rawname@value},
7897 \luastringO{\forename@value},
7898 \luastringO{\surname@value},
7899 \luastringO{\addname@value},
7900 \luastringO{\note@value})}
7901 \egroup
7902 }
7903 \@onlypreamble\DeclareScholar
7904 % \end{macrocode}
7905 % \end{macro}
7906 % \begin{macro}{\DeclareSource}
7907 % \changes{v1.1}{2020/11/04}{new command added}There is also a table in
7908 % which are collected data related to sources to be used in the
7909 % apparatus criticus. \cs{DeclareSource} is a preamble-only
7910 % command and takes two mandatory arguments: a unique id and a
7911 % shorthand (preferably a Bib\hologo{(La)TeX} label) to be used in
7912 % the apparatus criticus which can be extracted from a bibliographic
7913 % database.
7914 % \begin{macrocode}
7915 \NewDocumentCommand{\DeclareSource}{m m}{
7916 \luadirect{ekdosis.newsource(\luastringN{#1},
7917 \luastringN{#2})}
7918 }
7919 \@onlypreamble\DeclareSource
7920 % \end{macrocode}
7921 % \end{macro}
7922 % \begin{macro}{\DeclareShorthand} \cs{DeclareShorthand} is a
7923 % preamble-only command that can be used to record manuscript
7924 % families or any kind of shorthand to be used to refer to
7925 % previously declared ids, for example the shorthand |codd| can be
7926 % used to point to all declared witnesses. This command takes three
7927 % mandatory arguments: a unique id, its rendition in print and a
7928 % csv-list of previously declared ids.
7929 % \begin{macrocode}
7930 \NewDocumentCommand{\DeclareShorthand}{m m m}{
7931 \luadirect{ekdosis.newshorthand(\luastringN{#1},
7932 \luastringN{#2},
7933 \luastringN{#3})}
7934 }
7935 \@onlypreamble\DeclareShorthand
7936 % \end{macrocode}
7937 % \end{macro}
7938 % \begin{macro}{\getsiglum}
7939 % \cs{getsiglum}\marg{csv list} takes a comma-separated list of
7940 % declared ids by means of \cs{DeclareWitness}, \cs{DeclareHand},
7941 % \cs{DeclareShorthand} or \cs{DeclareSource} and returns their
7942 % respective renditions.
7943 % \begin{macrocode}
7944 \NewDocumentCommand{\getsiglum}{m}{%
7945 \luadirect{tex.sprint(ekdosis.getsiglum(\luastringN{#1}))}%
7946 }
7947 % \end{macrocode}
7948 % \end{macro}
7949 % \begin{macro}{\SigLine}
7950 % \cs{Sigline}\marg{unique id} takes the unique id of any declared
7951 % witness by means of \cs{DeclareWitness} as argument and returns a
7952 % line ready to be inserted in a table set to print a Conspectus
7953 % Siglorum. \cs{SigLine} returns three fields separated by the symbol
7954 % |&| that is used in tables as follows: the siglum referring to the
7955 % witness, the contents of the |description| field and the contents of
7956 % the optional |origDate| field.
7957 % \begin{macrocode}
7958 \NewDocumentCommand{\SigLine}{m}{%
7959 \luadirect{tex.sprint(ekdosis.basic_cs(\luastringN{#1}))}
7960 }
7961 % \end{macrocode}
7962 % \end{macro}
7963 % \paragraph{\TeX\ to \texttt{TEI xml}}
7964 % Here follow the |key-value| options to be used by \cs{SetTEIxmlExport}
7965 % below:---
7966 % \begin{macrocode}
7967 \ekvdefinekeys{tei@settings}{
7968 choice autopar = {true = \luadirect{ekdosis.setteiautopar("yes")},
7969 false = {\luadirect{ekdosis.setteiautopar("no")}}},
7970 initial autopar = true,
7971 unknown-choice autopar = \PackageError{ekdosis}{unknown
7972 autopar=#1}{`autopar' must be either `true' or `false'.}
7973 }
7974 % \end{macrocode}
7975 % \begin{macro}{\SetTEIxmlExport}
7976 % \cs{SetTEIxmlExport} collects the settings to be applied
7977 % to \texttt{TEI xml} export. For now, there is only one option. This
7978 % command can be used at any point of the document, except inside
7979 % environments meant to receive an apparatus criticus.
7980 % \begin{macrocode}
7981 \NewDocumentCommand{\SetTEIxmlExport}{m}{
7982 \unless\ifekd@state\ekvset{tei@settings}{#1}\fi
7983 }
7984 % \end{macrocode}
7985 % \end{macro}
7986 % The following three commands can be used to instruct \pkg{ekdosis}
7987 % how to convert unknown or unusual \hologo{(La)TeX} commands into
7988 % \texttt{TEI xml} equivalents.
7989 % \begin{macro}{\TeXtoTEI}
7990 % \cs{TeXtoTEI}\marg{csname}\marg{TEI element}\oarg{TEI attribute(s)}
7991 % takes two mandatory arguments and one optional argument, namely: the
7992 % control sequence name to be converted, the \texttt{TEI} element it
7993 % is to be converted into and any additional \texttt{xml} attributes
7994 % to be appended to the opening \texttt{TEI} element:---
7995 % \begin{macrocode}
7996 \NewDocumentCommand{\TeXtoTEI}{m m O{}}{%
7997 \luadirect{ekdosis.newcmdtotag(\luastringN{#1},
7998 \luastringN{#2},
7999 \luastringN{#3})}
8000 }
8001 % \end{macrocode}
8002 % \end{macro}
8003 % \begin{macro}{\teidirect}
8004 % \changes{v1.3}{2021/08/18}{direct insertion of elements in the
8005 % \texttt{TEI xml} file}
8006 % \cs{teidirect}\oarg{xml attributes}\marg{xml element}\marg{code}
8007 % does nothing in \LaTeX. Its only use is to insert elements in the
8008 % \texttt{TEI xml} output file.
8009 % \begin{macrocode}
8010 \NewDocumentCommand{\teidirect}{O{}mm}{\ignorespaces}
8011 % \end{macrocode}
8012 % \end{macro}
8013 % \begin{macro}{\EnvtoTEI}
8014 % \begin{macro}{\EnvtoTEI*}
8015 % \cs{EnvtoTEI}\meta{*}\marg{env name}\marg{TEI element}\oarg{TEI
8016 % attribute(s)} instructs how to convert \LaTeX{} environments into
8017 % \texttt{TEI xml} equivalents. It takes two mandatory arguments and
8018 % one optional argument, namely the name of the \LaTeX{} environment
8019 % to be converted, the \texttt{TEI} element it is to be converted into
8020 % and any additional attributes to be appended to the \texttt{TEI}
8021 % opening element. \cs{EnvtoTEI*} is restricted to \texttt{TEI}
8022 % elements that must never appear within |<p>| elements, such as
8023 % |<div>|, |<lg>| and the like.
8024 % \begin{macrocode}
8025 \NewDocumentCommand{\EnvtoTEI}{s m m O{}}{%
8026 \IfBooleanTF{#1}{%
8027 \luadirect{ekdosis.newenvtotag(\luastringN{#2},
8028 \luastringN{#3},
8029 \luastringN{#4},
8030 "yes")}
8031 }{%
8032 \luadirect{ekdosis.newenvtotag(\luastringN{#2},
8033 \luastringN{#3},
8034 \luastringN{#4})}
8035 }
8036 }
8037 % \end{macrocode}
8038 % \end{macro}
8039 % \end{macro}
8040 % \begin{macro}{\TeXtoTEIPat}
8041 % \changes{v1.1}{2020/11/04}{renamed, formerly \cs{TeXtoTEIPatt}}
8042 % Finally, the more flexible\---and more delicate to
8043 % handle\---\cs{TeXtoTEIPat}\marg{\TeX\
8044 % pattern}\allowbreak\marg{\texttt{TEI} pattern} uses pattern matching
8045 % to instruct \pkg{ekdosis} how to convert \hologo{(La)TeX} commands
8046 % into \texttt{TEI} equivalents.
8047 % \begin{macrocode}
8048 \NewDocumentCommand{\TeXtoTEIPat}{m m}{%
8049 \luadirect{ekdosis.newpatttotag(\luastringN{#1}, \luastringN{#2})}
8050 }
8051 % \end{macrocode}
8052 % \end{macro}
8053 % \begin{macro}{\SetTEIFilename} \cs{SetTEIFilename}\marg{basename} is
8054 % a preamble-only command. It is used to set the base name of the
8055 % |TEI xml| output file, to which the suffix |.xml| is appended. By
8056 % default, the base name is |\jobname-tei|:---
8057 % \begin{macrocode}
8058 \NewDocumentCommand{\SetTEIFileName}{m}{
8059 \luadirect{ekdosis.setteifilename(\luastringN{#1})}
8060 }
8061 \@onlypreamble\SetTEIFileName
8062 % \end{macrocode}
8063 % \end{macro}
8064 % \begin{macro}{\AddxmlBibResource} This is a preamble-only command.
8065 % If a base name (either suffixed with |.xml| or not) for a
8066 % \texttt{TEI xml}-compliant bibliographical database file be
8067 % provided with \cs{AddxmlBibResource}\marg{basename or name.xml},
8068 % \pkg{ekdosis} will use it and insert formatted data in the back
8069 % matter section of its own \texttt{TEI xml} output file, as
8070 % |<biblStruct>| elements within a |<listBibl>| section.
8071 % \begin{macrocode}
8072 \NewDocumentCommand{\AddxmlBibResource}{m}{
8073 \luadirect{ekdosis.addxmlbibresource(\luastringN{#1})}
8074 }
8075 \@onlypreamble\AddxmlBibResource
8076 % \end{macrocode}
8077 % \end{macro}
8078 % \begin{macro}{\ekd@test@lang}
8079 % \cs{ekd@test@lang} is used internally by \pkg{ekdosis}. This command
8080 % returns \cs{ekd@lang@pkgtrue} if either \pkg{babel} or
8081 % \pkg{polyglossia} be used so that \cs{languagename} can be inserted
8082 % when and where needed in the apparatus criticus.
8083 % \begin{macrocode}
8084 \newif\ifekd@lang@pkg
8085 \NewDocumentCommand{\ekd@test@lang}{}{%
8086 \ltx@ifpackageloaded{babel}{\ekd@lang@pkgtrue}{}%
8087 \ltx@ifpackageloaded{polyglossia}{\ekd@lang@pkgtrue}{}%
8088 }
8089 % \end{macrocode}
8090 % \end{macro}
8091 % \paragraph{Multiple-layer apparatuses}
8092 % \pkg{ekdosis} must know if an entry is to be processed in a single-
8093 % or multiple-layer context:---
8094 % \begin{macrocode}
8095 \newif\ifekd@mapps
8096 % \end{macrocode}
8097 % Now the key-value options can be defined:---
8098 % \begin{macrocode}
8099 \ekvdefinekeys{ekd@newapp}{
8100 choice direction = {LR = \def\direction@val{LR},
8101 RL = \def\direction@val{RL}},
8102 unknown-choice direction = \PackageError{ekdosis}{unknown
8103 direction=#1}{`direction' must be either `LR' or `RL'.},
8104 store rule = \rule@val,
8105 nmeta norule = {rule=none},
8106 code delim = \def\delim@val{\unexpanded{#1}},
8107 store sep = \sep@val,
8108 store subsep = \subsep@val,
8109 store bhook = \bhook@val,
8110 store ehook = \ehook@val,
8111 store maxentries = \limit@val,
8112 store lang = \lang@val,
8113 store notelang = \notelang@val,
8114 initial direction = LR,
8115 initial delim = {},
8116 initial ehook = {\csname ekd@end@apparatus\endcsname}
8117 }
8118 % \end{macrocode}
8119 % \begin{macro}{\DeclareApparatus}
8120 % \cs{DeclareApparatus}\marg{apparatus name}\oarg{options} is a
8121 % preamble-only command. As a mandatory argument, it takes the name of
8122 % the new layer of notes to be inserted in the apparatus block. Then,
8123 % the following seven key-value options can be used to lay out the
8124 % layer: \verb+direction=LR|RL+, |rule|, |delim| (the delimiter between
8125 % entries), |sep| (the separator between lemma part and readings or
8126 % notes), |bhook| (\LaTeX{} code inserted as the layer begins),
8127 % |ehook| (\LaTeX{} code inserted as the layer ends), |maxentries|
8128 % (if set and |maxentries >= 10|, the number of entries at which a
8129 % \cs{pagebreak} is issued):---
8130 % \begin{macrocode}
8131 \NewDocumentCommand{\DeclareApparatus}{m O{}}{
8132 \newbool{subsq@unit@#1}
8133 \booltrue{subsq@unit@#1}
8134 \unless\ifekd@mapps\global\ekd@mappstrue\fi
8135 \bgroup
8136 \ekvset{ekd@newapp}{#2}
8137 \luadirect{ekdosis.newapparatus(
8138 \luastringN{#1},
8139 \luastring{\direction@val},
8140 \luastringO{\rule@val},
8141 \luastringO{\delim@val},
8142 \luastringO{\sep@val},
8143 \luastringO{\subsep@val},
8144 \luastringO{\bhook@val},
8145 \luastringO{\ehook@val},
8146 \luastringO{\limit@val},
8147 \luastringO{\lang@val},
8148 \luastringO{\notelang@val}
8149 )}
8150 \egroup
8151 }
8152 \@onlypreamble\DeclareApparatus
8153 % \end{macrocode}
8154 % \end{macro}
8155 % \begin{macro}{\addentries}
8156 % \changes{v1.1}{2020/11/04}{modifies the number of accepted entries
8157 % on the current page.}
8158 % If |maxentries| be set for a given layer of critical notes,
8159 % \cs{addentries}\oarg{layer}\marg{n}, where \meta{n} is an integer,
8160 % can be used to add \meta{n} to\---or remove it from if \meta{n} be
8161 % negative\---the number of accepted entries on the current
8162 % page. \cs{addentries} operates on the default layer of notes, but
8163 % any other declared layer can be specified in the optional argument
8164 % of the command.
8165 % \begin{macrocode}
8166 \NewDocumentCommand{\addentries}{O{\ekdan@type} m}{%
8167 \luadirect{ekdosis.addto_bagunits(\luastringO{#1}, \luastringN{#2})}%
8168 \ignorespaces
8169 }
8170 % \end{macrocode}
8171 % \end{macro}
8172 % \begin{macro}{\ekdpb}
8173 % \changes{v1.2}{2021/04/02}{conditional page breaks}
8174 % \cs{ekdpk}\oarg{page no}\marg{line no} is used to insert conditional
8175 % page breaks by specifying that the page break should occur only on a
8176 % given line and optionally a given page. If the specified conditions
8177 % be met then this command triggers \cs{pagebreak}.
8178 % \begin{macrocode}
8179 \newcounter{ekd@pb}
8180 \globalcounter{ekd@pb}
8181 \NewDocumentCommand{\ekdpb}{s o m}{%
8182 \IfBooleanTF{#1}
8183 {\ifekd@showpb\marginpar{\ekd@hpbmk}\fi
8184 \pagebreak}
8185 {%
8186 \def\@tmpoarg{#2}%
8187 \def\@tmpmarg{#3}%
8188 \stepcounter{ekd@pb}%
8189 \linelabel{ekdpb:\theekd@pb}%
8190 \def\tmp@ln{%
8191 \getrefnumber{ekdpb:\theekd@pb}}%
8192 \def\tmp@pg{%
8193 \getpagerefnumber{ekdpb:\theekd@pb}}%
8194 \IfNoValueTF{#2}
8195 {\ifnum
8196 \pdf@strcmp{\@tmpmarg}{\tmp@ln} = 0
8197 \ifekd@showpb\marginpar{\ekd@spbmk}\fi
8198 \pagebreak
8199 \else
8200 \ifekd@showpb\marginpar{[\ekd@spbmk]}\fi
8201 \fi}
8202 {\ifnum
8203 \pdf@strcmp{\@tmpoarg}{\tmp@pg} = 0
8204 \ifnum
8205 \pdf@strcmp{\@tmpmarg}{\tmp@ln} = 0
8206 \ifekd@showpb\marginpar{\ekd@spbmk}\fi
8207 \pagebreak
8208 \else
8209 \ifekd@showpb\marginpar{[\ekd@spbmk]}\fi
8210 \fi
8211 \fi
8212 }%
8213 }\ignorespaces
8214 }
8215 % \end{macrocode}
8216 % \end{macro}
8217 % Apparatus-related settings and functions. Some booleans to check if
8218 % an apparatus should be inserted and what is the current environment.
8219 % \begin{macrocode}
8220 \newbool{do@app}
8221 \newif\ifekd@state
8222 \newif\ifekd@isinapp
8223 \newif\ifekd@isinlem
8224 \newif\ifekd@appinapp
8225 % \end{macrocode}
8226 % The next boolean is shared with \pkg{arabluatex}. \cs{LRnum} is used
8227 % internally to ensure that numerals referring to line spans are
8228 % displayed in the right order.
8229 % \begin{macrocode}
8230 \providebool{al@rlmode}
8231 \@ifpackageloaded{arabluatex}{}{%
8232 \def\setRL{\booltrue{al@rlmode}\pardir TRT\textdir TRT}
8233 \def\setLR{\boolfalse{al@rlmode}\pardir TLT \textdir TLT}
8234 }
8235 \protected\def\LRnum#1{\bgroup\textdir TLT#1\egroup}
8236 % \end{macrocode}
8237 % Set counter referring to line numbers and make it global.
8238 % \begin{macrocode}
8239 \newcounter{ekd@lab}
8240 \globalcounter{ekd@lab}
8241 % \end{macrocode}
8242 % This command inserts words in the apparatus criticus without
8243 % checking if both |ekd@isinapp| and |ekd@state| are set to |true|.
8244 % \begin{macrocode}
8245 \NewDocumentCommand{\unconditional@appin}{o m}{%
8246 \IfNoValueTF{#1}
8247 {\luadirect{ekdosis.appin(\luastringO{#2})}}
8248 {\luadirect{ekdosis.appin(\luastringO{#2}, \luastringO{#1})}}%
8249 }
8250 % \end{macrocode}
8251 % \begin{macro}{\blfootnote} \cs{blfootnote}\marg{footnote} is used
8252 % internally to insert the apparatus in the footnote block should the
8253 % global optional argument |layout| be set to |footins|. Therefore, it
8254 % is not documented.
8255 % \begin{macrocode}
8256 \def\blfootnote{\gdef\@thefnmark{\relax}\@footnotetext}
8257 % \def\blfootnote{\gdef\@thefnmark{}\@blfootnotetext}
8258 \long\def\@blfootnotetext#1{\insert\footins{%
8259 \reset@font\footnotesize
8260 \interlinepenalty\interfootnotelinepenalty
8261 \splittopskip\footnotesep
8262 \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
8263 \hsize\columnwidth \@parboxrestore
8264 \protected@edef\@currentlabel{%
8265 \csname p@footnote\endcsname\@thefnmark
8266 }%
8267 \color@begingroup
8268 \@makeblfntext{%
8269 \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
8270 \color@endgroup}}%
8271 \newcommand\@makeblfntext[1]{%
8272 \parindent 1em%
8273 \noindent
8274 \hb@xt@0em{\hss\@makefnmark}#1}
8275 % \end{macrocode}
8276 % \end{macro}
8277 % \paragraph{Single-layer apparatus} The following commands are for
8278 % general settings. All of them can be used in the preamble or at any
8279 % point of the document. The keys to be used follow:---
8280 % \begin{macrocode}
8281 \newif\ifrtl@app
8282 \edef\ekdsep{] }
8283 \edef\ekdsubsep{}
8284 \ekvdefinekeys{default@app}{
8285 choice direction = {LR = \rtl@appfalse,
8286 RL = \rtl@apptrue},
8287 unknown-choice direction = \PackageError{ekdosis}{unknown
8288 direction=#1}{`direction' must be either `LR' or `RL'.},
8289 code sep = \edef\ekdsep{#1},
8290 code subsep = \edef\ekdsubsep{#1},
8291 store bhook = \ekd@begin@apparatus,
8292 initial bhook = {},
8293 store ehook = \ekd@end@apparatus,
8294 initial ehook = {},
8295 store delim = \ekd@unit@delim,
8296 initial delim = {},
8297 store rule = \ekd@default@rule,
8298 initial rule = \rule{0.4\columnwidth}{0.4pt},
8299 noval norule = \def\ekd@default@rule{\mbox{}},
8300 store lang = \ekd@singleapp@lang,
8301 initial lang = \ltx@ifpackageloaded{babel}{\languagename}{%
8302 \ltx@ifpackageloaded{polyglossia}{\languagename}{}},
8303 store notelang = \ekd@singleapp@note@lang,
8304 initial notelang = \ltx@ifpackageloaded{babel}{\languagename}{%
8305 \ltx@ifpackageloaded{polyglossia}{\languagename}{}}
8306 }
8307 % \end{macrocode}
8308 % \begin{macro}{\SetApparatus}
8309 % All settings can also be defined as |key-value| options within the
8310 % argument of \cs{SetApparatus}:---
8311 % \begin{macrocode}
8312 \NewDocumentCommand{\SetApparatus}{m}{
8313 \ekvset{default@app}{#1}
8314 }
8315 % \end{macrocode}
8316 % \end{macro}
8317 % \begin{macro}{\SetLTRapp}
8318 % \begin{macro}{\SetRTLapp}
8319 % \cs{SetLTRapp} and \cs{SetRTLapp} are two argument-less commands to
8320 % set the direction of single-layer apparatus criticus, either LTR or
8321 % RTL:---
8322 % \begin{macrocode}
8323 \NewDocumentCommand{\SetRTLapp}{}{\rtl@apptrue}
8324 \NewDocumentCommand{\SetLTRapp}{}{\rtl@appfalse}
8325 % \end{macrocode}
8326 % \end{macro}
8327 % \end{macro}
8328 % \begin{macro}{\SetSeparator}
8329 % \cs{SetSeparator}\marg{separator} allows to change the separator
8330 % between lemma texts and variant readings, which is by default
8331 % a closing square bracket followed by a space (\verb*+] +):---
8332 % \begin{macrocode}
8333 \NewDocumentCommand{\SetSeparator}{m}{\edef\ekdsep{#1}}
8334 % \end{macrocode}
8335 % \end{macro}
8336 % \begin{macro}{\SetSubseparator}
8337 % \changes{v1.4}{2021/11/21}{New command for subseparators}
8338 % \cs{SetSubseparator}\marg{sub-separator} allows to change the
8339 % \enquote{subseparator} between variant readings. By default,
8340 % no subseparator is set:---
8341 % \begin{macrocode}
8342 \NewDocumentCommand{\SetSubseparator}{m}{\edef\ekdsubsep{#1}}
8343 % \end{macrocode}
8344 % \end{macro}
8345 % \begin{macro}{\SetBeginApparatus}
8346 % \cs{SetBeginApparatus}\marg{characters} can be used to append
8347 % characters at the beginning of the apparatus block. By default,
8348 % nothing is appended:---
8349 % \begin{macrocode}
8350 \NewDocumentCommand{\SetBeginApparatus}{m}{\edef\ekd@begin@apparatus{#1}}
8351 % \end{macrocode}
8352 % \end{macro}
8353 % \begin{macro}{\SetEndApparatus}
8354 % \cs{SetEndApparatus}\marg{characters} can be used to append
8355 % characters at the end of the apparatus block\---such as a period,
8356 % as it is customary in some editions. By default, nothing is
8357 % appended:---
8358 % \begin{macrocode}
8359 \NewDocumentCommand{\SetEndApparatus}{m}{\edef\ekd@end@apparatus{#1}}
8360 % \end{macrocode}
8361 % \end{macro}
8362 % \begin{macro}{\SetUnitDelimiter}
8363 % \cs{SetUnitDelimiter}\marg{delimiter} can be used to set the
8364 % delimiter between entries in the apparatus criticus. By default,
8365 % there is no delimiter except a simple space. \cs{SetUnitDelimiter}
8366 % can be used to insert a broad space (with |\hskip| for instance, as
8367 % in the OCT series) or the divider-sign (‖, as in the Budé series):---
8368 % \begin{macrocode}
8369 \NewDocumentCommand{\SetUnitDelimiter}{m}{\def\ekd@unit@delim{#1}}
8370 % \end{macrocode}
8371 % \end{macro}
8372 % \begin{macro}{\SetApparatusLanguage}
8373 % \changes{v1.2}{2021/04/02}{defines an alternate language to be
8374 % applied in apparatus entries}
8375 % \cs{SetApparatusLang}\marg{languagename} can be used when
8376 % it is needed to apply in the apparatus criticus a language
8377 % different from the one that is selected in the edition text.
8378 % \begin{macrocode}
8379 \NewDocumentCommand{\SetApparatusLanguage}{m}{%
8380 \def\ekd@singleapp@lang{#1}}
8381 % \end{macrocode}
8382 % \end{macro}
8383 % \begin{macro}{\SetApparatusNoteLanguage}
8384 % \changes{v1.3}{2021/08/18}{defines an alternate language to be
8385 % applied in note apparatus entries}
8386 % \cs{SetApparatusNoteLang}\marg{languagename} can be used when
8387 % it is needed to apply in entries introduced by the \cs{note} command
8388 % a language different from the one that is selected in the edition
8389 % text.
8390 % \begin{macrocode}
8391 \NewDocumentCommand{\SetApparatusNoteLanguage}{m}{%
8392 \def\ekd@singleapp@note@lang{#1}}
8393 % \end{macrocode}
8394 % \end{macro}
8395 % \begin{macro}{\footnoteruletrue}
8396 % \begin{macro}{\footnoterulefalse}
8397 % As \pkg{ekdosis} takes care of drawing a rule separating the main
8398 % text from the apparatus block as well as layers of notes from each
8399 % other inside this block, it may not be desirable to have
8400 % the standard \LaTeX{} \enquote{footnoterule} printed on every page
8401 % of the edition text. \cs{footnoterulefalse} removes it while
8402 % \cs{footnoteruletrue} leaves it untouched. The latter is set by
8403 % default.
8404 % \begin{macrocode}
8405 \newif\iffootnoterule
8406 \footnoteruletrue
8407 \let\dflt@footnoterule\footnoterule
8408 \let\dflt@pcol@footnoterule\pcol@footnoterule
8409 \renewcommand\footnoterule{%
8410 \iffootnoterule
8411 \dflt@footnoterule%
8412 \fi
8413 }
8414 \renewcommand\pcol@footnoterule{%
8415 \iffootnoterule
8416 \dflt@pcol@footnoterule%
8417 \fi
8418 }
8419 % \end{macrocode}
8420 % \end{macro}
8421 % \end{macro}
8422 % \begin{macro}{\SetDefaultRule}
8423 % By default, \pkg{ekdosis} draws separating rules the definition of
8424 % which is |\rule{0.4\columnwid|\allowbreak|th}{0.4pt}|. This can be
8425 % changed in the preamble or at any point of the document with
8426 % \cs{SetDefaultRule}\marg{\allowbreak{}rule definition}. Leaving
8427 % this argument empty as in \cs{SetDefaultRule}|{}| removes the
8428 % rule.
8429 % \begin{macrocode}
8430 \NewDocumentCommand{\SetDefaultRule}{m}{%
8431 \def\@tempa{#1}
8432 \ifx\@tempa\empty\def\ekd@default@rule{\mbox{}}%
8433 \else%
8434 \def\ekd@default@rule{#1}%
8435 \fi}
8436 % \end{macrocode}
8437 % \end{macro}
8438 % \begin{macro}{\NLS}
8439 % \cs{NLS} was previously adapted from a snippet written by Heiko
8440 % Oberdiek. It is used by \pkg{ekdosis} internally to prevent page
8441 % breaks between separating rules and subsequent notes. Therefore, it
8442 % is not documented.
8443 % \begin{macrocode}
8444 \newcommand*{\NLS}{%
8445 \nobreak\@normalcr\relax
8446 % \par
8447 % \nobreak
8448 % \vspace{-\parskip}%
8449 % \leavevmode
8450 % \noindent
8451 % \ignorespaces
8452 }
8453 % \end{macrocode}
8454 % \end{macro}
8455 % This boolean is used to test if a given entry is to be preceded by a
8456 % numeral referring to the line of the edition text.
8457 % \begin{macrocode}
8458 \newif\ifsubsq@unit
8459 \subsq@unittrue
8460 % \end{macrocode}
8461 % \cs{add@@apparatus} inserts the apparatus block on a given page
8462 % either in the footnote floating block or in a float of its own,
8463 % depending on the value set in the |layout| global option. As some
8464 % commands need to know whether they are called from inside the
8465 % apparatus criticus, two conditionals are first defined.
8466 % \begin{macrocode}
8467 \newif\ifekd@inside@app
8468 \newif\ifekd@keepinapp
8469 % \end{macrocode}
8470 % Then \cs{ekd@fitapp} is defined for |layout=fitapp|:---
8471 % \begin{macrocode}
8472 \if@pkg@fitapp
8473 \newtcboxfit{\ekd@fitapp}{%
8474 blankest,
8475 fit basedim = \f@size pt,
8476 fit fontsize macros,
8477 fit height from=0pt to \ekd@app@height,
8478 fit algorithm = \ekd@fit@algorithm,
8479 float=!b}
8480 \fi
8481 % \end{macrocode}
8482 % Finally two commands are used to actually insert the apparatus
8483 % depending on the value set in the |layout| global option.
8484 % \begin{macrocode}
8485 \long\def\ekd@insert@apparatus{%
8486 \unless\ifekd@mapps
8487 \ifrtl@app\pardir TRT\leavevmode\textdir TRT\else
8488 \pardir TLT\leavevmode\textdir TLT\fi
8489 \fi
8490 \if@pkg@parnotes
8491 \if@parnotesroman
8492 \renewcommand*{\theparnotemark}{\roman{parnotemark}}\fi
8493 \parnoteclear\fi
8494 \ekd@inside@apptrue
8495 \ekd@appfontsize
8496 \ifekd@mapps
8497 \ifdefined\ekd@initial@rule
8498 \ekd@initial@rule
8499 \fi
8500 \fi
8501 \apparatus\unless\ifekd@mapps\ekd@end@apparatus\fi
8502 \ekd@inside@appfalse
8503 \if@pkg@parnotes\parnotes\parnotereset\fi
8504 }%
8505 \def\add@@apparatus{%
8506 \if@pkg@parnotes\parnotes\else\fi
8507 \if@pkg@footins
8508 \bgroup
8509 \unless\ifekd@mapps
8510 \ifrtl@app\pardir TRT\leavevmode\textdir TRT\else
8511 \pardir TLT\leavevmode\textdir TLT\fi
8512 \fi
8513 \blfootnote{%
8514 \if@pkg@parnotes
8515 \if@parnotesroman
8516 \renewcommand*{\theparnotemark}{\roman{parnotemark}}\else\fi
8517 \parnoteclear\else\fi
8518 \ekd@inside@apptrue
8519 \ekd@appfontsize
8520 \ifekd@mapps
8521 \ifdefined\ekd@initial@rule
8522 \ekd@initial@rule
8523 \fi
8524 \fi
8525 \apparatus\unless\ifekd@mapps\ekd@end@apparatus\fi
8526 \ekd@inside@appfalse
8527 \if@pkg@parnotes\parnotes\parnotereset\else\fi
8528 }%
8529 \egroup
8530 \fi
8531 \if@pkg@float
8532 \begin{ekdapparatus}[!b]%
8533 \ekd@insert@apparatus
8534 \end{ekdapparatus}%
8535 \fi
8536 \if@pkg@keyfloat
8537 \ekd@insert@keyparapp
8538 \fi
8539 \if@pkg@fitapp
8540 \ekd@fitapp{\ekd@insert@apparatus}%
8541 \fi
8542 }
8543 % \end{macrocode}
8544 % Before inserting any new entry, \cs{add@apparatus} calls
8545 % \cs{test@apparatus} to decide whether a new apparatus block must be
8546 % created on a given page.
8547 % \begin{macrocode}
8548 \def\add@apparatus{%
8549 \test@apparatus%
8550 \ifbool{do@app}{\subsq@unitfalse\add@@apparatus}{}%
8551 }
8552 % \end{macrocode}
8553 % \cs{append@app} inserts a bare (sub)entry in the apparatus...
8554 % \begin{macrocode}
8555 \NewDocumentCommand{\append@app}{o +m}{%
8556 \ifekd@isinapp%
8557 \ifekd@state%
8558 \IfNoValueTF{#1}%
8559 {\luadirect{ekdosis.appin(\luastringO{#2})}}%
8560 {\luadirect{ekdosis.appin(\luastringO{#2}, \luastringO{#1})}}%
8561 \fi%
8562 \fi}
8563 % \end{macrocode}
8564 % while \cs{append@ln@app} inserts a (sub)entry possibly preceded by a
8565 % line number.
8566 % \begin{macrocode}
8567 \NewDocumentCommand{\append@ln@app}{o +m}{%
8568 \IfNoValueTF{#1}
8569 {\luadirect{tex.sprint(ekdosis.mdvappend(\luastringO{#2}))}}
8570 {\luadirect{tex.sprint(ekdosis.mdvappend(\luastringO{#2},
8571 \luastringO{#1}))}}}
8572 % \end{macrocode}
8573 % \paragraph{Lineation Settings}
8574 % \begin{macro}{\outerlinenumbers}
8575 % \begin{macro}{\innerlinenumbers}
8576 % \pkg{ekdosis} does not use the \enquote{pagewise} numbering mode
8577 % that is provided by \pkg{lineno}. Therefore,
8578 % \cs{outerlinenumbers} and \cs{innerlinenumbers} are defined in
8579 % addition to \cs{rightlinenum{\allowbreak}bers} and
8580 % \cs{leftlinenumbers}.
8581 % \begin{macrocode}
8582 \def\outerlinenumbers{%
8583 \def\makeLineNumberRunning{%
8584 \checkoddpage
8585 \ifoddpage
8586 \linenumberfont\hskip\linenumbersep\hskip\textwidth
8587 \hbox to\linenumberwidth{\hss\LineNumber}\hss
8588 \else
8589 \hss\linenumberfont\LineNumber\hskip\linenumbersep
8590 \fi
8591 }%
8592 }
8593 \def\innerlinenumbers{%
8594 \def\makeLineNumberRunning{%
8595 \checkoddpage
8596 \ifoddpage
8597 \hss\linenumberfont\LineNumber\hskip\linenumbersep
8598 \else
8599 \linenumberfont\hskip\linenumbersep\hskip\textwidth
8600 \hbox to\linenumberwidth{\hss\LineNumber}\hss
8601 \fi
8602 }%
8603 }
8604 % \end{macrocode}
8605 % \end{macro}
8606 % \end{macro}
8607 % The keys to be used for lineation settings follow. A conditional is
8608 % defined beforehand so that \pkg{ekdosis} may know whether the
8609 % numbering should start afresh at the top of each page.
8610 % \begin{macrocode}
8611 \newif\ifekd@pagelineation
8612 \newif\ifekd@pagevlineation
8613 \NewDocumentCommand{\ekdatbegshihook}{}{%
8614 \ifekd@pagelineation\resetlinenumber\fi
8615 }
8616 \AddToHook{shipout/before}{\ekdatbegshihook}
8617 \newif\ifekd@elidednumbers
8618 \ekvdefinekeys{ekd@lineation}{
8619 choice lineation = {page = \ekd@pagelineationtrue,
8620 document = \ekd@pagelineationfalse,
8621 none = \ekd@pagelineationtrue
8622 \renewcommand\thelinenumber{}},
8623 unknown-choice lineation = \PackageError{ekdosis}{unknown
8624 lineation=#1}{`lineation' must be either `page' or `document'.},
8625 choice vlineation = {page = \ekd@pagevlineationtrue,
8626 document = \ekd@pagevlineationfalse},
8627 unknown-choice vlineation = \PackageError{ekdosis}{unknown
8628 vlineation=#1}{`vlineation' must be either `page' or `document'.},
8629 code modulonum = \chardef\c@linenumbermodulo#1\relax,
8630 noval modulo = \modulolinenumbers,
8631 code vmodulo = \ifekd@memoir@loaded\linenumberfrequency{#1}
8632 \else\if@pkg@poetry@verse\poemlines{#1}\fi\fi,
8633 initial vmodulo = 1,
8634 default vmodulo = 5,
8635 bool vnumbrokenlines = \ifnum@brokenline,
8636 bool continuousvnum = \if@continuous@vnum,
8637 choice numbers = {elided = \ekd@elidednumberstrue,
8638 full = \ekd@elidednumbersfalse},
8639 unknown-choice numbers = \PackageError{ekdosis}{unknown
8640 numbers=#1}{`numbers' must be either `elided' or `full'.},
8641 initial numbers = elided,
8642 choice margin = {right = \rightlinenumbers,
8643 left = \leftlinenumbers,
8644 inner = \innerlinenumbers,
8645 outer = \outerlinenumbers},
8646 unknown-choice margin = \PackageError{ekdosis}{unknown
8647 margin=#1}{`margin' must be either `left', `right', \MessageBreak
8648 `inner' or `outer'},
8649 choice vmargin = {
8650 right = \if@pkg@poetry@verse\verselinenumbersright\fi,
8651 left = \if@pkg@poetry@verse\verselinenumbersleft\fi},
8652 unknown-choice vmargin = \PackageError{ekdosis}{unknown
8653 vmargin=#1}{`margin' must be either `left' ot `right'}
8654 }
8655 % \end{macrocode}
8656 % \begin{macro}{\SetLineation}
8657 % Then \cs{SetLineation}\marg{options} can be used in the preamble or
8658 % at any point of the document to set lineation preferences. Its
8659 % argument processes the |key-value| options that are defined just
8660 % above.
8661 % \begin{macrocode}
8662 \NewDocumentCommand{\SetLineation}{m}{
8663 \ekvset{ekd@lineation}{#1}
8664 }
8665 % \end{macrocode}
8666 % \end{macro}
8667 % \begin{macro}{\vmodulolinenumbers}
8668 % \changes{v1.4}{2021/11/21}{New command to adjust modulo verse line
8669 % numbering}
8670 % \begin{macrocode}
8671 \NewDocumentCommand{\vmodulolinenumbers}{O{5}}{%
8672 \ifekd@memoir@loaded
8673 \linenumberfrequency{#1}%
8674 \else
8675 \if@pkg@poetry@verse
8676 \poemlines{#1}%
8677 \fi
8678 \fi
8679 \ignorespaces
8680 }
8681 % \end{macrocode}
8682 % \end{macro}
8683 % Use |\normalfont| for line numbers:---
8684 % \begin{macrocode}
8685 \renewcommand\linenumberfont{\normalfont\footnotesize}
8686 % \end{macrocode}
8687 % \begin{macro}{\SetDefaultApparatus}
8688 % By default, \pkg{ekdosis} defines one layer of critical notes which
8689 % is called |default|. This name can be changed at any point of the
8690 % document with \cs{SetDefaultApparatus}\marg{name}.
8691 % \begin{macrocode}
8692 \ekvdefinekeys{appnote}{
8693 store type = \ekdan@type,
8694 initial type = default
8695 }
8696 \NewDocumentCommand{\SetDefaultApparatus}{m}{%
8697 \ekvset{appnote}{type=#1}}
8698 % \end{macrocode}
8699 % \end{macro}
8700 % \begin{macro}{\app}
8701 % \cs{app}|[type=|\meta{type}|]|\marg{apparatus entries} takes one
8702 % mandatory argument and accepts one optional argument. |type=| refers
8703 % to the layer the note must go into and \meta{apparatus entries}
8704 % contains command used to insert the entries, either \cs{lem},
8705 % \cs{rdg} or \cs{note}\meta{*}:---
8706 % \begin{macrocode}
8707 \NewDocumentCommand{\app}{O{} > { \TrimSpaces } +m}{%
8708 \leavevmode
8709 \begingroup
8710 \ekvset{appnote}{#1}%
8711 \ifekd@isinapp\ekd@appinapptrue\fi
8712 \ekd@isinapptrue
8713 \stepcounter{ekd@lab}%
8714 \zlabel{ekd:\theekd@lab}%
8715 \luadirect{ekdosis.storeabspg(
8716 \luastring{\zref@extract{ekd:\theekd@lab}{abspage}})}%
8717 \ifekd@state\add@apparatus\fi
8718 \luadirect{tex.sprint(ekdosis.removesp(\luastringN{#2}))}%
8719 \ekd@isinappfalse
8720 \ekd@appinappfalse
8721 \endgroup}
8722 % \end{macrocode}
8723 % \end{macro}
8724 % \begin{macro}{\ekdpage}
8725 % \changes{v1.4}{2021/11/21}{prints page marks used internally by
8726 % \textsf{ekdosis} to generate the apparatus blocks on pages}
8727 % Instead of absolute page numbers, \pkg{ekdosis} now marks the
8728 % entries of the apparatus with its own page numbering
8729 % scheme. \cs{ekdpage} can be used at any point of the document to
8730 % retrieve and print the current number.
8731 % \begin{macrocode}
8732 \NewDocumentCommand{\ekdpage}{}{%
8733 \luadirect{tex.sprint(ekdosis.getekdabspg())}%
8734 }
8735 % \end{macrocode}
8736 % \end{macro}
8737 % \cs{current@ref@arg} is used outside \cs{app} by \cs{note}. It takes
8738 % two mandatory arguments: the beginning line label and the ending
8739 % line label\---which are manually inserted---and returns the formatted
8740 % reference to be inserted in the apparatus criticus.
8741 % \begin{macrocode}
8742 \def\current@ref@arg#1#2{{%\textdir TLT%
8743 \unexpanded\expandafter{\ekd@refnumstyle}%
8744 \ifnum%
8745 \pdf@strcmp{\getpagerefnumber{#1}}{\getpagerefnumber{#2}}
8746 =
8747 0
8748 \ifnum%
8749 \pdf@strcmp{\getrefnumber{#1}}{\getrefnumber{#2}}
8750 =
8751 0
8752 %
8753 \ifekd@mapps%
8754 \ifbool{subsq@unit@\ekdan@type}{%
8755 \ifnum%
8756 \pdf@strcmp{\getrefnumber{#1}}{%
8757 \getrefnumber{\luadirect{tex.sprint(ekdosis.getprevnotelab())}}}
8758 =
8759 0
8760 \else
8761 \LRnum{\getrefnumber{#1}}\unexpanded\expandafter{\ekd@postrefnum}% issue the no
8762 \fi%
8763 }%
8764 {\LRnum{\getrefnumber{#1}}\unexpanded\expandafter{\ekd@postrefnum}}% issue the no
8765 \else
8766 \ifsubsq@unit%
8767 %
8768 \ifnum%
8769 \pdf@strcmp{\getrefnumber{#1}}{%
8770 \getrefnumber{\luadirect{tex.sprint(ekdosis.getprevnotelab())}}}
8771 =
8772 0
8773 \else
8774 \LRnum{\getrefnumber{#1}}\unexpanded\expandafter{\ekd@postrefnum}% issue the no
8775 \fi
8776 %
8777 \else
8778 \LRnum{\getrefnumber{#1}}\unexpanded\expandafter{\ekd@postrefnum}% issue the no
8779 \fi
8780 \fi
8781 %
8782 \else
8783 \ifekd@elidednumbers
8784 \luadirect{tex.sprint(ekdosis.numrange(\luastring{\getrefnumber{#1}},
8785 \luastring{\getrefnumber{#2}}))}%
8786 \unexpanded\expandafter{\ekd@postrefnum}% issue the nos
8787 \else
8788 \LRnum{\getrefnumber{#1}}--%
8789 \LRnum{\getrefnumber{#2}}\unexpanded\expandafter{\ekd@postrefnum}% issue the nos
8790 \fi
8791 \fi%
8792 \else
8793 \ifboolexpr{bool {ekd@pagelineation} or bool {ekd@pagevlineation}}
8794 {\LRnum{\getrefnumber{#1}}--%
8795 \LRnum{\getpagerefnumber{#2}}.%
8796 \LRnum{\getrefnumber{#2}}\unexpanded\expandafter{\ekd@postrefnum}}% issue pg and ln nos
8797 {\LRnum{\getrefnumber{#1}}--%
8798 \LRnum{\getrefnumber{#2}}\unexpanded\expandafter{\ekd@postrefnum}}% issue the nos
8799 \fi%
8800 \ifekdn@forcenum
8801 \LRnum{\getrefnumber{#1}}\unexpanded\expandafter{\ekd@postrefnum}% force the no
8802 \fi
8803 }%
8804 }
8805 % \end{macrocode}
8806 % \cs{current@ref} is pretty much the same as \cs{current@reg@arg},
8807 % but takes no argument. It is used by commands such as \cs{lem} when
8808 % references to page and line numbers can be returned by \textsf{Lua}.
8809 % \begin{macrocode}
8810 \def\current@ref{{%\textdir TLT%
8811 \unexpanded\expandafter{\ekd@refnumstyle}%
8812 \ifnum%
8813 \pdf@strcmp{%
8814 \getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}%
8815 {\getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}
8816 =
8817 0
8818 \ifnum%
8819 \pdf@strcmp{%
8820 \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}%
8821 {\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}
8822 =
8823 0
8824 %
8825 \ifekd@mapps%
8826 \ifbool{subsq@unit@\ekdan@type}{%
8827 \ifnum%
8828 \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}%
8829 {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevlnlab())}-b}}
8830 =
8831 0
8832 %%%begin
8833 \ifnum%
8834 \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}%
8835 {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevlnlab())}-e}}
8836 =
8837 0
8838 \ifekd@appinapp
8839 \ifnum%
8840 \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}%
8841 {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevprevlnlab())}-b}}
8842 =
8843 0
8844 \else
8845 \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}%
8846 \unexpanded\expandafter{\ekd@postrefnum}% issue the no
8847 \fi
8848 \fi
8849 \else
8850 \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}%
8851 \unexpanded\expandafter{\ekd@postrefnum}% issue the no
8852 \fi
8853 %%% end
8854 \else
8855 \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}%
8856 \unexpanded\expandafter{\ekd@postrefnum}% issue the no
8857 \fi%
8858 }{\LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}%
8859 \unexpanded\expandafter{\ekd@postrefnum}}% issue the no
8860 \else
8861 \ifsubsq@unit%
8862 %
8863 \ifnum%
8864 \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}%
8865 {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevlnlab())}-b}}
8866 =
8867 0
8868 %%%begin
8869 \ifnum%
8870 \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}%
8871 {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevlnlab())}-e}}
8872 =
8873 0
8874 \ifekd@appinapp
8875 \ifnum%
8876 \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}%
8877 {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevprevlnlab())}-b}}
8878 =
8879 0
8880 \else
8881 \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}%
8882 \unexpanded\expandafter{\ekd@postrefnum}% issue the no
8883 \fi
8884 \fi
8885 \else
8886 \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}%
8887 \unexpanded\expandafter{\ekd@postrefnum}% issue the no
8888 \fi
8889 %%% end
8890 \else
8891 \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}%
8892 \unexpanded\expandafter{\ekd@postrefnum}% issue the no
8893 \fi
8894 %
8895 \else
8896 \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}%
8897 \unexpanded\expandafter{\ekd@postrefnum}% issue the no
8898 \fi
8899 \fi
8900 %
8901 \else
8902 \ifekd@elidednumbers
8903 \luadirect{tex.sprint(ekdosis.numrange(
8904 \luastring{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}},
8905 \luastring{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}))}%
8906 \unexpanded\expandafter{\ekd@postrefnum}% issue the nos
8907 \else
8908 \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}--%
8909 \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}%
8910 \unexpanded\expandafter{\ekd@postrefnum}% issue the nos
8911 \fi
8912 \fi%
8913 \else
8914 \ifboolexpr{bool {ekd@pagelineation} or bool {ekd@pagevlineation}}
8915 {\LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}--%
8916 \LRnum{\getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}.%
8917 \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}%
8918 \unexpanded\expandafter{\ekd@postrefnum}}% issue pg and ln nos
8919 {\LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}--%
8920 \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}%
8921 \unexpanded\expandafter{\ekd@postrefnum}}% issue the nos
8922 \fi%
8923 \ifekdl@forcenum
8924 \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}%
8925 \unexpanded\expandafter{\ekd@postrefnum}% force the no
8926 \fi
8927 }%
8928 }
8929 % \end{macrocode}
8930 % Define keys to be used by the optional arguments of \cs{lem} and
8931 % \cs{rdg}:---
8932 % \begin{macrocode}
8933 \newif\ifekdl@forcenum
8934 \newif\ifekdl@nonum
8935 \ekvdefinekeys{lem}{
8936 code wit = \def\ekdlr@wit{#1},
8937 code source = \def\ekdlr@source{#1},
8938 code resp = \def\ekdlr@resp{#1},
8939 code alt = \def\ekdlr@alt{#1},
8940 code pre = \def\ekdlr@pre{#1},
8941 code post = \def\ekdlr@post{#1},
8942 code prewit = \def\ekdlr@prewit{#1},
8943 code postwit = \def\ekdlr@postwit{#1},
8944 store type = \ekdlr@type,
8945 store sep = \ekdl@sep,
8946 noval nonum = \ekdl@nonumtrue,
8947 noval num = \ekdl@forcenumtrue,
8948 bool nolem = \ifekdl@nolem,
8949 bool nosep = \ifekdl@nosep,
8950 initial sep = \ekdsep
8951 }
8952 \ekvdefinekeys{rdg}{
8953 code wit = \def\ekdlr@wit{#1},
8954 code source = \def\ekdlr@source{#1},
8955 code resp = \def\ekdlr@resp{#1},
8956 code alt = \def\ekdlr@alt{#1},
8957 code pre = \def\ekdlr@pre{#1},
8958 code post = \def\ekdlr@post{#1},
8959 code prewit = \def\ekdlr@prewit{#1},
8960 code postwit = \def\ekdlr@postwit{#1},
8961 store subsep = \ekdr@subsep,
8962 initial subsep = \ekdsubsep,
8963 bool nosubsep = \ifekdr@nosubsep,
8964 store type = \ekdlr@type,
8965 bool nordg = \ifekdr@nordg
8966 }
8967 % \end{macrocode}
8968 % \begin{macro}{\rdgGrp}
8969 % \changes{v1.1}{2020/11/04}{new macro for grouping readings}
8970 % \cs{rdgGrp}\oarg{option}\marg{lemma and/or readings} may be used to
8971 % group readings so as to indicate subvariation in apparatus
8972 % entries. This command is expected inside \cs{app}|{}|, and takes as
8973 % argument readings to be grouped introduced by means of \cs{lem}
8974 % and/or \cs{rdg} commands. It further accepts |type| as an optional
8975 % key-value argument to describe the type of grouping.
8976 % \begin{macrocode}
8977 \NewDocumentCommand{\rdgGrp}{O{} > {\TrimSpaces } m}{%
8978 \luadirect{tex.sprint(ekdosis.removesp(\luastringN{#2}))}%
8979 }
8980 % \end{macrocode}
8981 % \end{macro}
8982 % \begin{macro}{\app@lang}
8983 % \begin{macro}{\app@note@lang}
8984 % \cs{app@lang} is used internally by \cs{lem} and \cs{rdg} to set the
8985 % language for apparatus entries. \cs{note} uses \cs{\app@note@lang}.
8986 % \begin{macrocode}
8987 \def\app@lang{%
8988 \ifekd@mapps
8989 \luadirect{tex.sprint(ekdosis.getapplang(\luastring{\ekdan@type}))}%
8990 \else
8991 \ekd@singleapp@lang
8992 \fi
8993 }
8994 \def\app@note@lang{%
8995 \ifekd@mapps
8996 \luadirect{tex.sprint(ekdosis.getappnotelang(\luastring{\ekdan@type}))}%
8997 \else
8998 \ekd@singleapp@note@lang
8999 \fi
9000 }
9001 % \end{macrocode}
9002 % \end{macro}
9003 % \end{macro}
9004 % \begin{macro}{\lem}
9005 % \cs{lem}\oarg{options}\marg{lemma text} inserts \meta{lemma text}
9006 % both in the edition text and in the apparatus criticus by default,
9007 % preceded by the reference to the line number or a space if it is the
9008 % same number as the one of the previous entry. This command accepts
9009 % the optional key-value arguments just defined above.
9010 % \begin{macrocode}
9011 \NewDocumentCommand{\lem}{O{} m}{%
9012 \ekd@isinlemtrue%
9013 \luadirect{ekdosis.dolnlab(\luastringN{#2})}%
9014 \null
9015 \bgroup%
9016 \ekdl@forcenumfalse
9017 \ekdl@nonumfalse
9018 \ekvset{lem}{#1}%
9019 \ekd@test@lang
9020 \ifekd@mapps%
9021 \ifnum%
9022 \luadirect{tex.sprint(ekdosis.get_bagunits(\luastringO{\ekdan@type}))}
9023 = 1
9024 \boolfalse{subsq@unit@\ekdan@type}%
9025 \fi%
9026 \luadirect{ekdosis.increment_bagunits(\luastringO{\ekdan@type})}%
9027 \def\ekd@munit@delim{%
9028 \luadirect{tex.sprint(ekdosis.getappdelim(\luastringO{\ekdan@type}))}}%
9029 \luadirect{tex.sprint(ekdosis.limit_bagunits(\luastringO{\ekdan@type}))}%
9030 \fi%
9031 \ifekdl@nolem\edef\lem@app{%
9032 % \hskip .75em
9033 \ifekd@mapps
9034 \ifbool{subsq@unit@\ekdan@type}%
9035 {\ekd@munit@delim}{}%
9036 \else%
9037 \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi%
9038 \fi%
9039 \unless\ifekdl@nonum\current@ref\fi}%\hskip .25em}%
9040 \else%
9041 \ifbool{al@rlmode}{%
9042 \edef\lem@app{%
9043 % \hskip .75em
9044 \ifekd@mapps
9045 \ifbool{subsq@unit@\ekdan@type}%
9046 {\ekd@munit@delim}{}%
9047 \else%
9048 \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi%
9049 \fi%
9050 \unless\ifekdl@nonum\current@ref\fi%\hskip .25em
9051 \ifdefined\ekdlr@alt%
9052 \ifdefined\ekdlr@post%
9053 \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi
9054 {\textdir TRT\unexpanded\expandafter{\ekd@lemmastyle}%
9055 \unexpanded\expandafter{\ekdlr@alt}}%
9056 \ifdefined\ekdlr@pre%
9057 \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi
9058 \else
9059 \ifdefined\ekdlr@post%
9060 \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi
9061 {\textdir TRT\unexpanded\expandafter{\ekd@lemmastyle}%
9062 \unexpanded{#2}}%
9063 \ifdefined\ekdlr@pre%
9064 \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi
9065 \fi
9066 \ifdefined\ekdlr@postwit%
9067 \space\unexpanded\expandafter{\ekdlr@postwit}\else\fi
9068 \ifdefined\ekdlr@resp\space\getsiglum{\ekdlr@resp}\else\fi
9069 \ifdefined\ekdlr@source\space\getsiglum{\ekdlr@source}\else\fi
9070 \ifdefined\ekdlr@wit\space\getsiglum{\ekdlr@wit}\else\fi
9071 \ifdefined\ekdlr@prewit%
9072 \space\unexpanded\expandafter{\ekdlr@prewit}\space\else\fi
9073 \ifekdl@nosep\else\unexpanded\expandafter{\ekdl@sep}\fi
9074 }%
9075 }%
9076 {%
9077 \edef\lem@app{%
9078 % \hskip .75em
9079 \ifekd@mapps
9080 \ifbool{subsq@unit@\ekdan@type}%
9081 {\ekd@munit@delim}{}%
9082 \else%
9083 \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi%
9084 \fi%
9085 \unless\ifekdl@nonum\current@ref\fi%\hskip .25em
9086 \ifdefined\ekdlr@alt%
9087 \ifdefined\ekdlr@pre%
9088 \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi
9089 \ifbool{ekd@lang@pkg}%
9090 {{\unexpanded\expandafter{\ekd@lemmastyle}%
9091 \noexpand\selectlanguage{\app@lang}%
9092 \unexpanded\expandafter{\ekdlr@alt}}}%
9093 {\unexpanded\expandafter{\ekd@lemmastyle}%
9094 \unexpanded\expandafter{\ekdlr@alt}}%
9095 \ifdefined\ekdlr@post%
9096 \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi
9097 \else
9098 \ifdefined\ekdlr@pre%
9099 \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi
9100 \ifbool{ekd@lang@pkg}%
9101 {{\unexpanded\expandafter{\ekd@lemmastyle}%
9102 \noexpand\selectlanguage{\app@lang}%
9103 \unexpanded{#2}}}{%
9104 {\unexpanded\expandafter{\ekd@lemmastyle}\unexpanded{#2}}}%
9105 \ifdefined\ekdlr@post%
9106 \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi
9107 \fi
9108 \ifdefined\ekdlr@prewit%
9109 \space\unexpanded\expandafter{\ekdlr@prewit}\space\else\fi
9110 \ifdefined\ekdlr@wit\space\getsiglum{\ekdlr@wit}\else\fi
9111 \ifdefined\ekdlr@source\space\getsiglum{\ekdlr@source}\else\fi
9112 \ifdefined\ekdlr@resp\space\getsiglum{\ekdlr@resp}\else\fi
9113 \ifdefined\ekdlr@postwit%
9114 \space\unexpanded\expandafter{\ekdlr@postwit}\else\fi
9115 \ifekdl@nosep\else\unexpanded\expandafter{\ekdl@sep}\fi
9116 }%
9117 }%
9118 \fi%
9119 \ifekd@mapps%
9120 \append@ln@app[\ekdan@type]{\lem@app}%
9121 \else%
9122 \append@ln@app{\lem@app}%
9123 \fi%
9124 \egroup%
9125 \ekd@isinlemfalse%
9126 \subsq@unittrue%
9127 }
9128 % \end{macrocode}
9129 % \end{macro}
9130 % \begin{macro}{\rdg}
9131 % \cs{rdg}\oarg{options}\marg{variant reading} inserts \meta{variant
9132 % reading} in the second part of the entry, after the lemma text and
9133 % the separator, in the apparatus criticus. This command accepts the
9134 % optional key-value arguments defined above. This command sets
9135 % \cs{ifekd@subsq@rdg} to true, which instructs \pkg{ekdosis} that
9136 % \enquote{subseparators} may be used for subsequent entries.
9137 % \begin{macrocode}
9138 \newif\ifekd@subsq@rdg
9139 \NewDocumentCommand{\rdg}{O{} m}{%
9140 \bgroup%
9141 \ekvset{rdg}{#1}%
9142 \ekd@test@lang
9143 % \ifekdr@nordg\append@app{}\else% do we need \append@app{} here? If
9144 % % so, keep in mind \ifekd@mapps,
9145 % like so:
9146 \ifekdr@nordg%
9147 \ifekd@mapps%
9148 \append@app[\ekdan@type]{}%
9149 \else%
9150 \append@app{}%
9151 \fi%
9152 \else%
9153 \ifbool{al@rlmode}{%
9154 \edef\rdg@app{%
9155 \ifekd@subsq@rdg
9156 \unless\ifekdr@nosubsep\unexpanded\expandafter{\ekdr@subsep}\fi
9157 \fi
9158 \ifdefined\ekdlr@alt%
9159 \ifdefined\ekdlr@post%
9160 \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi
9161 {\textdir TRT\unexpanded\expandafter{\ekd@readingstyle}%
9162 \unexpanded\expandafter{\ekdlr@alt}}%
9163 \ifdefined\ekdlr@pre%
9164 \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi
9165 \else
9166 \ifdefined\ekdlr@post%
9167 \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi
9168 {\textdir TRT\unexpanded\expandafter{\ekd@readingstyle}%
9169 \unexpanded{#2}}%
9170 \ifdefined\ekdlr@pre%
9171 \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi
9172 \fi
9173 \ifdefined\ekdlr@postwit%
9174 \space\unexpanded\expandafter{\ekdlr@postwit}\else\fi
9175 \ifdefined\ekdlr@resp\space\getsiglum{\ekdlr@resp}\else\fi
9176 \ifdefined\ekdlr@source\space\getsiglum{\ekdlr@source}\else\fi
9177 \ifdefined\ekdlr@wit\space\getsiglum{\ekdlr@wit}\else\fi
9178 \ifdefined\ekdlr@prewit%
9179 \space\unexpanded\expandafter{\ekdlr@prewit}\space\else\fi
9180 }%
9181 }%
9182 {%
9183 \edef\rdg@app{%
9184 \ifekd@subsq@rdg
9185 \unless\ifekdr@nosubsep\unexpanded\expandafter{\ekdr@subsep}\fi
9186 \fi
9187 \ifdefined\ekdlr@alt%
9188 \ifdefined\ekdlr@pre%
9189 \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi
9190 \ifbool{ekd@lang@pkg}%
9191 {{\unexpanded\expandafter{\ekd@readingstyle}%
9192 \noexpand\selectlanguage{\app@lang}%
9193 \unexpanded\expandafter{\ekdlr@alt}}}%
9194 {\unexpanded\expandafter{\ekd@readingstyle}%
9195 \unexpanded\expandafter{\ekdlr@alt}}%
9196 \ifdefined\ekdlr@post%
9197 \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi
9198 \else
9199 \ifdefined\ekdlr@pre%
9200 \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi
9201 \ifbool{ekd@lang@pkg}%
9202 {{\unexpanded\expandafter{\ekd@readingstyle}%
9203 \noexpand\selectlanguage{\app@lang}\unexpanded{#2}}}{%
9204 {\unexpanded\expandafter{\ekd@readingstyle}\unexpanded{#2}}}%
9205 \ifdefined\ekdlr@post%
9206 \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi
9207 \fi
9208 \ifdefined\ekdlr@prewit%
9209 \space\unexpanded\expandafter{\ekdlr@prewit}\space\else\fi
9210 \ifdefined\ekdlr@wit\space\getsiglum{\ekdlr@wit}\else\fi
9211 \ifdefined\ekdlr@source\space\getsiglum{\ekdlr@source}\else\fi
9212 \ifdefined\ekdlr@resp\space\getsiglum{\ekdlr@resp}\else\fi
9213 \ifdefined\ekdlr@postwit%
9214 \space\unexpanded\expandafter{\ekdlr@postwit}\else\fi
9215 }%
9216 }%
9217 \ifekd@mapps
9218 \append@app[\ekdan@type]{\rdg@app}%
9219 \else
9220 \append@app{\rdg@app}%
9221 \fi
9222 \fi
9223 \egroup
9224 \ekd@subsq@rdgtrue
9225 }
9226 % \end{macrocode}
9227 % \end{macro}
9228 % Define keys to be used by the optional argument of \cs{note} when
9229 % this command is found outside \cs{app}:---
9230 % \begin{macrocode}
9231 \newif\ifekdn@forcenum
9232 \ekvdefinekeys{note}{
9233 store type = \ekdan@type,
9234 store lem = \ekdn@lem,
9235 code labelb = \def\ekdn@labelb{#1},
9236 code labele = \def\ekdn@labele{#1},
9237 store sep = \ekdn@sep,
9238 bool nosep = \ifekdn@nosep,
9239 initial type = default,
9240 initial sep = \ekdsep,
9241 bool nonum = \ifekdn@nonum,
9242 noval num = \ekdn@forcenumtrue
9243 }
9244 % \end{macrocode}
9245 % \cs{note@noapp} is used internally when a \cs{note} command is found
9246 % outside \cs{app}. This command is mostly used to insert short
9247 % comments or references to texts quoted or cited in the edition text
9248 % to go into additional layers of the apparatus criticus, e.g.\ the
9249 % \emph{apparatus testium}. It accepts the optional key-value
9250 % arguments just defined above. It must be noted that |labelb| must be
9251 % specified; otherwise \pkg{ekdosis} will issue an error message.
9252 % \begin{macrocode}
9253 \NewDocumentCommand{\note@noapp}{O{} +m}{%
9254 \leavevmode
9255 \bgroup%
9256 \ekvset{note}{#1}%
9257 \ekd@test@lang
9258 \stepcounter{ekd@lab}%
9259 \zlabel{ekd:\theekd@lab}%
9260 \luadirect{ekdosis.storeabspg(
9261 \luastring{\zref@extract{ekd:\theekd@lab}{abspage}})}%
9262 \ifekd@state\add@apparatus\fi%
9263 \ifekd@mapps%
9264 \ifnum%
9265 \luadirect{tex.sprint(ekdosis.get_bagunits(\luastringO{\ekdan@type}))}
9266 = 1
9267 \boolfalse{subsq@unit@\ekdan@type}%
9268 \fi%
9269 \luadirect{ekdosis.increment_bagunits(\luastringO{\ekdan@type})}%
9270 \def\ekd@munit@delim{%
9271 \luadirect{tex.sprint(ekdosis.getappdelim(\luastringO{\ekdan@type}))}}%
9272 \luadirect{tex.sprint(ekdosis.limit_bagunits(\luastringO{\ekdan@type}))}%
9273 \fi%
9274 \ifdefined\ekdn@labelb%
9275 \luadirect{tex.sprint(ekdosis.setnotelab(\luastringO{\ekdn@labelb}))}%
9276 \ifdefined\ekdn@labele\else\def\ekdn@labele{\ekdn@labelb}\fi%
9277 \else\PackageError{ekdosis}{missing labelb}{`labelb' must be
9278 set.}\fi%
9279 \ifbool{al@rlmode}%
9280 {\edef\note@contents{%
9281 % \hskip .75em
9282 \ifekd@mapps
9283 \ifbool{subsq@unit@\ekdan@type}%
9284 {\ekd@munit@delim}{}%
9285 \else%
9286 \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi%
9287 \fi%
9288 \unless\ifekdn@nonum\current@ref@arg{\ekdn@labelb}{\ekdn@labele}\fi%\hskip .25em
9289 \ifdefined\ekdn@lem%
9290 {\textdir TRT\unexpanded\expandafter{\ekd@lemmastyle}%
9291 \unexpanded\expandafter{\ekdn@lem}}%
9292 \unless\ifekdn@nosep
9293 \unexpanded\expandafter{\ekdn@sep}\fi
9294 \else\fi%
9295 {\textdir TRT\unexpanded{#2}}}}%
9296 {\edef\note@contents{%
9297 % \hskip .75em
9298 \ifekd@mapps
9299 \ifbool{subsq@unit@\ekdan@type}%
9300 {\ekd@munit@delim}{}%
9301 \else%
9302 \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi%
9303 \fi%
9304 \unless\ifekdn@nonum\current@ref@arg{\ekdn@labelb}{\ekdn@labele}\fi%\hskip .25em
9305 \ifdefined\ekdn@lem
9306 \ifbool{ekd@lang@pkg}%
9307 {{\unexpanded\expandafter{\ekd@lemmastyle}%
9308 \noexpand\selectlanguage{\app@lang}%
9309 \unexpanded\expandafter{\ekdn@lem}}}%
9310 {\unexpanded\expandafter{\ekd@lemmastyle}%
9311 \unexpanded\expandafter{\ekdn@lem}}%
9312 \unless\ifekdn@nosep
9313 \unexpanded\expandafter{\ekdn@sep}\fi
9314 \else\fi%
9315 \ifbool{ekd@lang@pkg}%
9316 {{\noexpand\selectlanguage{\app@note@lang}\unexpanded{#2}}}{%
9317 {\unexpanded{#2}}}}}%
9318 \ifekd@mapps%
9319 \unconditional@appin[\ekdan@type]{\note@contents}%
9320 \else%
9321 \unconditional@appin{\note@contents}%
9322 \fi%
9323 \luadirect{ekdosis.setprevnotelab(\luastringO{\ekdn@labelb})}%
9324 \egroup
9325 \subsq@unittrue
9326 \ignorespaces
9327 }
9328 % \end{macrocode}
9329 % Define keys to be used by the optional argument of \cs{note} when
9330 % this command is found inside \cs{app}:---
9331 % \begin{macrocode}
9332 \ekvdefinekeys{ekd@note}{
9333 store pre = \pre@value,
9334 store post = \post@value,
9335 nmeta sep = {post=\ekdsep},
9336 nmeta subsep = {pre=\ekdsubsep}
9337 }
9338 % \end{macrocode}
9339 % The following three commands, \cs{note@app}, \cs{ekd@note} and
9340 % \cs{ekd@note@star} are used internally when a \cs{note} command is
9341 % found inside \cs{app}. These commands are used to insert short
9342 % comments after the lemma text or after any variant reading in the
9343 % apparatus criticus. \cs{note@app} and subsequently \cs{ekd@note} and
9344 % \cs{ekd@note@star} accept the optional key-value arguments just
9345 % defined above.
9346 % \begin{macrocode}
9347 \NewDocumentCommand{\ekd@note}{O{} m}{%
9348 \bgroup%
9349 \ekvset{ekd@note}{#1}%
9350 \edef\note@contents{%
9351 \ekvifdefinedNoVal{ekd@note}{pre}{}{%
9352 \unexpanded\expandafter{\pre@value}}%
9353 {\unexpanded{#2}}%
9354 \ekvifdefinedNoVal{ekd@note}{post}{}{%
9355 \unexpanded\expandafter{\post@value}}%
9356 }%
9357 \ifekd@mapps%
9358 \append@app[\ekdan@type]{\note@contents}%
9359 \else%
9360 \append@app{\note@contents}%
9361 \fi%
9362 \egroup%
9363 }
9364 \NewDocumentCommand{\ekd@note@star}{O{} m}{%
9365 \bgroup
9366 \ekvset{ekd@note}{#1}%
9367 \edef\note@contents{%
9368 \ekvifdefinedNoVal{ekd@note}{pre}{}{%
9369 \unexpanded\expandafter{\pre@value}}%
9370 \if@pkg@parnotes
9371 \unskip\noexpand\parnote{\unexpanded{#2}}%
9372 \else
9373 \unskip\noexpand\footnote{\unexpanded{#2}}%
9374 \fi
9375 \ekvifdefinedNoVal{ekd@note}{post}{}{%
9376 \unexpanded\expandafter{\post@value}}%
9377 }%
9378 \ifekd@mapps
9379 \append@app[\ekdan@type]{\note@contents}%
9380 \else
9381 \append@app{\note@contents}%
9382 \fi
9383 \egroup
9384 }
9385 \NewDocumentCommand{\note@app}{s O{} +m}{%
9386 \ifbool{al@rlmode}{%
9387 \IfBooleanTF{#1}{\ekd@note@star[#2]{%
9388 {\textdir TRT#3}}}
9389 {\ekd@note[#2]{{\textdir TRT#3}}}%
9390 }{%
9391 \IfBooleanTF{#1}{\ekd@note@star[#2]{#3}}
9392 {\ekd@note[#2]{#3}}%
9393 }%
9394 }
9395 % \end{macrocode}
9396 % \begin{macro}{\note}
9397 % Finally, \cs{note} is a simple command designed to check whether
9398 % \cs{note} itself is called inside or outside \cs{app}. Then, unless
9399 % it is found inside \cs{lem}, it calls \cs{note@app} in the former
9400 % case and \cs{note@noapp} in the latter case:---
9401 % \begin{macrocode}
9402 \NewDocumentCommand{\note}{s O{} +m}{%
9403 \ifekd@state%
9404 \ifekd@isinapp%
9405 \ifekd@isinlem%
9406 \note@noapp[#2]{#3}%
9407 \else%
9408 \IfBooleanTF{#1}{\note@app*[#2]{#3}}{\note@app[#2]{#3}}%
9409 \fi%
9410 \else%
9411 \note@noapp[#2]{#3}%
9412 \fi%
9413 \fi%
9414 }
9415 % \end{macrocode}
9416 % \end{macro}
9417 % \paragraph{Emendations and Conjectures}
9418 % Here follows the |key-value| options to be used by
9419 % \cs{SetCritSymbols} below:---
9420 % \begin{macrocode}
9421 \ekvdefinekeys{ekd@corr}{
9422 store suppbegin = \suppb@value,
9423 store suppend = \suppe@value,
9424 store delbegin = \delb@value,
9425 store delend = \dele@value,
9426 store sicbegin = \sicb@value,
9427 store sicend = \sice@value,
9428 store gapmark = \gapm@value,
9429 initial suppbegin = \ifbool{al@rlmode}{>}{<},
9430 initial suppend = \ifbool{al@rlmode}{<}{>},
9431 initial delbegin = \ifbool{al@rlmode}{\}}{\{},
9432 initial delend = \ifbool{al@rlmode}{\{}{\}},
9433 initial sicbegin = \dag,
9434 initial sicend = \dag,
9435 initial gapmark = ***,
9436 bool keepinapp = \ifekd@keepinapp
9437 }
9438 % \end{macrocode}
9439 % \begin{macro}{\supplied}
9440 % \changes{v1.1}{2020/11/04}{new macro for editorial additions}
9441 % \cs{supplied}\marg{text} takes as mandatory argument the text added
9442 % or supplied by conjecture.
9443 % \begin{macrocode}
9444 \NewDocumentCommand{\supplied}{m}{%
9445 \ifekd@inside@app
9446 \ifekd@keepinapp
9447 \suppb@value #1\suppe@value
9448 \else
9449 #1%
9450 \fi
9451 \else
9452 \suppb@value #1\suppe@value
9453 \fi
9454 }
9455 % \end{macrocode}
9456 % \end{macro}
9457 % \begin{macro}{\surplus}
9458 % \changes{v1.1}{2020/11/04}{new macro for editorial deletions}
9459 % \cs{surplus}\marg{text} takes as mandatory argument the text
9460 % considered by the editor to be inauthentic, but nevertheless
9461 % retained between braces in the edition text as it is transmitted by
9462 % all witnesses.
9463 % \begin{macrocode}
9464 \NewDocumentCommand{\surplus}{m}{%
9465 \ifekd@inside@app
9466 \ifekd@keepinapp
9467 \delb@value #1\dele@value
9468 \else
9469 #1%
9470 \fi
9471 \else
9472 \delb@value #1\dele@value
9473 \fi
9474 }
9475 % \end{macrocode}
9476 % \end{macro}
9477 % \begin{macro}{\sic}
9478 % \changes{v1.1}{2020/11/04}{new macro for text deemed to be not
9479 % understandable}
9480 % \cs{sic}\marg{text} takes as mandatory argument the text deemed by
9481 % the editor to be readable but not understandable. \cs{sic} insert
9482 % \meta{text} between cruces while \cs{sic*} prints only one crux
9483 % before \meta{text}.
9484 % \begin{macrocode}
9485 \NewDocumentCommand{\sic}{s m}{%
9486 \ifekd@inside@app
9487 \ifekd@keepinapp
9488 \IfBooleanTF{#1}
9489 {\sicb@value #2}
9490 {\sicb@value #2\sice@value}%
9491 \else
9492 #2%
9493 \fi
9494 \else
9495 \IfBooleanTF{#1}
9496 {\sicb@value #2}
9497 {\sicb@value #2\sice@value}%
9498 \fi
9499 }
9500 % \end{macrocode}
9501 % \end{macro}
9502 % \begin{macro}{\gap}
9503 % \changes{v1.1}{2020/11/04}{new macro for lacunae}
9504 % \cs{gap}\marg{options} indicates that some amount of text has fallen
9505 % away from the entire tradition. It takes as mandatory argument a
9506 % comma-separated list of options that can be used to further specify
9507 % the reason for omission, the unit of measurement, the quantity and
9508 % extent.
9509 % \begin{macrocode}
9510 \NewDocumentCommand{\gap}{m}{%
9511 \gapm@value
9512 }
9513 % \end{macrocode}
9514 % \end{macro}
9515 % \begin{macro}{\SetCritSymbols}
9516 % \changes{v1.1}{2020/11/04}{new macro to set the symbols to be
9517 % used to mark the corrections} \cs{SetCritSymbols}\marg{csv list of
9518 % options} is used to change the symbols that \pkg{ekdosis} uses by
9519 % default for representing emendations, lacunae, omissions, gaps and
9520 % editorial deletions.
9521 % \begin{macrocode}
9522 \NewDocumentCommand{\SetCritSymbols}{m}{
9523 \ekvset{ekd@corr}{#1}
9524 }
9525 % \end{macrocode}
9526 % \end{macro}
9527 % \cs{apparatus} is used internally by \pkg{ekdosis} to print the
9528 % apparatus at the bottom of pages. Therefore, it is not documented,
9529 % but this may change in the future for it will be possible to have
9530 % apparatuses printed at other places.
9531 % \begin{macrocode}
9532 \NewDocumentCommand{\apparatus}{}{%
9533 \luadirect{tex.sprint(ekdosis.appout())}}
9534 % \end{macrocode}
9535 % The following two commands call \textsf{Lua} functions to check
9536 % whether an apparatus should be printed on a given page and to store
9537 % the current column id.
9538 % \begin{macrocode}
9539 \NewDocumentCommand{\test@apparatus}{}{%
9540 \luadirect{tex.sprint(ekdosis.testapparatus())}}
9541 \NewDocumentCommand{\ekd@storecol}{}{%
9542 \luadirect{ekdosis.storecurcol(\luastring{\thecolumn})}%
9543 }
9544 % \end{macrocode}
9545 % Start and stop |ekdosis|:
9546 % \begin{macrocode}
9547 \NewDocumentCommand{\EkdosisOn}{}{%
9548 \ekd@statetrue}
9549 \NewDocumentCommand{\EkdosisOff}{}{%
9550 \ekd@statefalse%
9551 }
9552 % \end{macrocode}
9553 % Neutralize unwanted commands provided by \pkg{lineno} within the
9554 % \env{ekdosis} environment:---
9555 % \begin{macrocode}
9556 \def\ekd@setlineno{%
9557 \let\setpagewiselinenumbers\relax%
9558 \let\pagewiselinenumbers\relax%
9559 \let\endpagewiselinenumbers\relax%
9560 \let\runningpagewiselinenumbers\relax%
9561 \let\realpagewiselinenumbers\relax%
9562 }
9563 % \end{macrocode}
9564 % \begin{environment}{ekdosis}
9565 % Finally comes the \env{ekdosis} environment meant to receive the
9566 % edition text equipped with an apparatus criticus. This environment
9567 % collects its contents and delivers it to \textsf{Lua} functions if a
9568 % \texttt{TEI xml} output file be desired.
9569 % \begin{macrocode}
9570 \NewDocumentEnvironment{ekdosis}{+b}{%
9571 \ekd@setlineno%
9572 \runninglinenumbers
9573 \EkdosisOn#1}{%
9574 \EkdosisOff
9575 \endrunninglinenumbers%
9576 \iftei@export
9577 \luadirect{ekdosis.exporttei(\luastringN{\par #1\par })}\fi}
9578 % \end{macrocode}
9579 % \end{environment}
9580 % \paragraph{Alignment} What follows is to arrange texts in parallel
9581 % columns either on single pages or on facing pages.
9582 %
9583 % Define keys to be used by the \env{alignment} environment:---
9584 % \begin{macrocode}
9585 \ekvdefinekeys{ekd@align}{
9586 store tcols = \tcols@num,
9587 store lcols = \lcols@num,
9588 store texts = \texts@value,
9589 store apparatus = \apparatus@value,
9590 bool paired = \ifekd@paired,
9591 choice lineation = {page = \ekd@pagelineationtrue,
9592 document = \ekd@pagelineationfalse},
9593 unknown-choice lineation = \PackageError{ekdosis}{unknown
9594 lineation=#1}{`lineation' must be either `page' or `document'.},
9595 choice segmentation = {auto = \def\segmentation@val{auto},
9596 noauto = \def\segmentation@val{noauto}},
9597 unknown-choice segmentation = \PackageError{ekdosis}{unknown
9598 segmentation=#1}{`segmentation' must be either `auto' or
9599 `noauto'.},
9600 bool flush = \ifekd@flushapp,
9601 initial tcols = 2,
9602 initial lcols = 1,
9603 initial texts = edition;translation,
9604 initial apparatus = edition,
9605 default segmentation = auto
9606 }
9607 % \end{macrocode}
9608 % \begin{macro}{\SetAlignment}
9609 % \cs{SetAlignment}\marg{settings} can be used either in the
9610 % preamble or at any point of the document to set or modify the
9611 % keys-value settings just defined above.
9612 % \begin{macrocode}
9613 \NewDocumentCommand{\SetAlignment}{m}{
9614 \ekvset{ekd@align}{#1}
9615 }
9616 % \end{macrocode}
9617 % \end{macro}
9618 % Patch \pkg{paracol} to insert a hook in \cs{pcol@nextpage}. This
9619 % hook is used to reset line numbers on new pages.
9620 % \begin{macrocode}
9621 \patchcmd{\pcol@nextpage}{%
9622 \endgroup}{%
9623 \ifekd@pagelineation\resetlinenumber\fi
9624 \endgroup}{}{}
9625 % \end{macrocode}
9626 % \cs{EkdosisColStart} and \cs{EkdosisColStop} initialize columns
9627 % meant to receive edition texts. These commands are used internally
9628 % by \pkg{ekdosis}.
9629 % \begin{macrocode}
9630 \NewDocumentCommand{\EkdosisColStart}{}{%
9631 \ekd@setlineno%
9632 \runninglinenumbers
9633 \ekd@storecol%
9634 \stepcounter{ekd@lab}%
9635 \zlabel{ekd:\theekd@lab}%
9636 \luadirect{%
9637 ekdosis.storeabspg(\luastring{\zref@extract{ekd:\theekd@lab}{abspage}},
9638 "pg_i")}%
9639 \ifekd@pagelineation
9640 \luadirect{tex.sprint(ekdosis.checkresetlineno())}
9641 \fi
9642 }
9643 \NewDocumentCommand{\EkdosisColStop}{}{%
9644 \stepcounter{ekd@lab}%
9645 \zlabel{ekd:\theekd@lab}%
9646 \luadirect{%
9647 ekdosis.storeabspg(\luastring{\zref@extract{ekd:\theekd@lab}{abspage}},
9648 "pg_ii")}%
9649 \endrunninglinenumbers%
9650 }
9651 % \end{macrocode}
9652 % \begin{environment}{alignment}
9653 % \cs{begin}|{alignment}|\oarg{options}\dots\cs{end}|{alignment}| can
9654 % be used as it is provided to typeset a standard critical edition
9655 % text on the left-hand pages accompanied with a translation on the
9656 % right-hand pages. To that effect, it provides by default two new
9657 % environments, \env{edition} and \env{translation}, to be used to
9658 % typeset both texts. (Either whole texts or texts entered by
9659 % paragraphs alternately.) The optional argument of \env{alignment}
9660 % accepts the exact same key-value options as \cs{SetAlignment}
9661 % described above. One may contrast these options with those accepted
9662 % by \cs{SetAlignment} as \enquote{local settings}.
9663 % \begin{macrocode}
9664 \NewDocumentEnvironment{alignment}{O{}}
9665 {%
9666 \ekvset{ekd@align}{#1}%
9667 \luadirect{ekdosis.mkenvdata(
9668 \luastring{\texts@value},
9669 "texts"
9670 )}
9671 \ifekd@flushapp
9672 \luadirect{ekdosis.newalignment("set")}
9673 \fi
9674 \luadirect{ekdosis.mkenvdata(
9675 \luastring{\apparatus@value}, "apparatus"
9676 )}
9677 \setrunninglinenumbers
9678 \luadirect{tex.sprint(ekdosis.mkenv())}
9679 \ifekd@paired
9680 \begin{paracol}[\lcols@num]{\tcols@num}
9681 \else
9682 \begin{paracol}[\lcols@num]*{\tcols@num}
9683 \fi
9684 }
9685 {\end{paracol}
9686 \iftei@export\luadirect{ekdosis.export_coldata_totei()}\fi
9687 \ifekd@flushapp
9688 \luadirect{ekdosis.newalignment("reset")}
9689 \fi
9690 \luadirect{ekdosis.flushenvdata()}
9691 \luadirect{ekdosis.flushcolnums()}
9692 }
9693 % \end{macrocode}
9694 % \end{environment}
9695 % \paragraph{Headers and Footers}
9696 % \pkg{ekdosis} provides a mechanism of its own for headers and
9697 % footers as follows. Most of it is handled by \textsf{Lua}
9698 % functions.
9699 % \begin{macro}{\ekd@storemark}
9700 % \cs{ekd@storemark} is used internally by the |mark| optional
9701 % argument of \cs{ekddiv} described below to store marks to be
9702 % printed at specific places in headers or footers.
9703 % \begin{macrocode}
9704 \NewDocumentCommand{\ekd@storemark}{m}{%
9705 \stepcounter{ekd@lab}%
9706 \label{ekd:\theekd@lab}%
9707 \luadirect{ekdosis.storehfmark(
9708 \luastring{\getpagerefnumber{ekd:\theekd@lab}},
9709 \luastringN{#1})}%
9710 }
9711 % \end{macrocode}
9712 % \end{macro}
9713 % \begin{macro}{\endmark}
9714 % \changes{v1.3}{2021/08/18}{prints the last-emitted mark of the
9715 % preceding page}
9716 % By default, \cs{ekdmark} described below prints the first mark
9717 % that is emitted on a given page and ignores the mark corresponding
9718 % to any portion of text that may be printed between the top of the
9719 % page and the point where the first mark is called. \cs{endmark} is
9720 % an argument-less command that can be used just at the end of that
9721 % portion of text to instruct \pkg{ekdosis} to print the last-emitted
9722 % mark of the preceding page instead of the first-emitted mark of the
9723 % current page.
9724 % \begin{macrocode}
9725 \NewDocumentCommand{\endmark}{}{%
9726 \stepcounter{ekd@lab}%
9727 \label{ekd:\theekd@lab}%
9728 \luadirect{ekdosis.storehfmark(
9729 \luastring{\getpagerefnumber{ekd:\theekd@lab}},
9730 "", "endmk")}%
9731 \ifdefined\xspace\xspace\fi
9732 }
9733 % \end{macrocode}
9734 % \end{macro}
9735 % \begin{macro}{\edkmark}
9736 % \changes{v1.3}{2021/08/18}{prints marks in headers or footers}
9737 % \cs{ekdmark} is an argument-less command called in commands used to
9738 % make headers and footers where the marks stored by means of the
9739 % |mark| optional argument of \cs{ekddiv} are to be printed.
9740 % \begin{macrocode}
9741 \NewDocumentCommand{\ekdmark}{}{%
9742 \luadirect{tex.sprint(ekdosis.gethfmark(\luastring{\thepage}))}%
9743 }
9744 % \end{macrocode}
9745 % \end{macro}
9746 % \begin{macro}{\ekdprintmark}
9747 % \changes{v1.3}{2021/08/18}{prints or removes the marks in headers
9748 % and footers} \cs{ekdprintmark}\marg{selector}\marg{signpost} The
9749 % signposts printed in headers and footers must be
9750 % passed as second argument of \cs{ekdprintmark} so that \pkg{ekdosis}
9751 % can remove them on pages where printing them is not
9752 % desirable. \meta{selector} refers to three symbolic letters where
9753 % the first can be either |H| or |F|\===for \underLine{h}eader or
9754 % \underLine{f}ooter\===, the second |E| or |O|\===for \underLine{o}dd
9755 % or \underLine{e}ven\===and the third |L|, |C| or |R|\===for
9756 % \underLine{l}eft, \underLine{c}enter or \underLine{r}ight:---
9757 % \begin{macrocode}
9758 \ekvdefinekeys{ekd@marks}{
9759 choice mark = {HEL = \def\ekd@mk{HEL},
9760 HEC = \def\ekd@mk{HEC},
9761 HER = \def\ekd@mk{HER},
9762 HOL = \def\ekd@mk{HOL},
9763 HOC = \def\ekd@mk{HOC},
9764 HOR = \def\ekd@mk{HOR},
9765 FEL = \def\ekd@mk{FEL},
9766 FEC = \def\ekd@mk{FEC},
9767 FEL = \def\ekd@mk{FER},
9768 FOL = \def\ekd@mk{FOL},
9769 FOC = \def\ekd@mk{FOC},
9770 FOL = \def\ekd@mk{FOR}},
9771 unknown-choice mark = \PackageError{ekdosis}{unknown mark=#1}{`mark'
9772 must be either `HEL', `HEC', `HER', `HOL', `HOC', `HOR', `FEL',
9773 \MessageBreak `FEC', `FER', `FOL', `FOC' or `FOR'.}
9774 }
9775 \NewDocumentCommand{\ekdprintmark}{m m}{%
9776 \bgroup
9777 \ekvset{ekd@marks}{mark = #1}%
9778 \luadirect{tex.sprint(ekdosis.printmark(\luastringN{#2},
9779 \luastringO{\ekd@mk}))}%
9780 \egroup
9781 }
9782 % \end{macrocode}
9783 % \end{macro}
9784 % \begin{macro}{\ekdnofhmarks}
9785 % \changes{v1.3}{2021/08/18}{removes headers and footers on specific
9786 % pages} Once the signposts are marked with \cs{ekdprintmark},
9787 % \cs{ekdnohfmarks} has the same effect as the \LaTeX\ standard
9788 % command \cs{thispagestyle}|{empty}|.
9789 % \begin{macrocode}
9790 \NewDocumentCommand{\ekdnohfmark}{}{%
9791 \luadirect{ekdosis.nohfmark()}%
9792 }
9793 % \end{macrocode}
9794 % \end{macro}
9795 % \begin{macro}{\ekdresethfmarks}
9796 % \changes{v1.3}{2021/08/18}{marks headers and footers as printable}
9797 % \cs{ekdresethfmarks} can be used in rare cases when it is needed to
9798 % reset headers and footers to their original, viz.\ printable state.
9799 % \begin{macrocode}
9800 \NewDocumentCommand{\ekdresethfmarks}{}{%
9801 \luadirect{ekdosis.resethfmark()}%
9802 }
9803 % \end{macrocode}
9804 % \end{macro}
9805 % \paragraph{Divisions of the Body}
9806 % \pkg{ekdosis} can convert \cs{book}, \cs{part}, \cs{chapter},
9807 % \cs{section}, \cs{subsec{\allowbreak}tion} and \cs{subsubsection}
9808 % into corresponding \texttt{TEI} \enquote*{numbered}
9809 % |<div|\textsubscript{\emph{n}}|>| elements, where $1\leq n\leq 6$.
9810 % \begin{macro}{\MkBodyDivs}
9811 % \cs{MkBodyDivs} is used to let \pkg{ekdosis} know which sectional
9812 % commands are actually being used in an edition text. This command
9813 % takes six mandatory arguments. For example, if \cs{section} and
9814 % \cs{subsection} are the only sectional commands being used,
9815 % |\MkBodyDivs{section}{subsection}{}{}{}{}| will have \cs{section}
9816 % and \cs{subsection} converted into |<div1>| and |<div2>|
9817 % respectively.
9818 % \begin{macrocode}
9819 \NewDocumentCommand{\MkBodyDivs}{mmmmmm}{
9820 \luadirect{ekdosis.mkdivdepths(
9821 \luastringN{#1},
9822 \luastringN{#2},
9823 \luastringN{#3},
9824 \luastringN{#4},
9825 \luastringN{#5},
9826 \luastringN{#6}
9827 )
9828 }
9829 }
9830 % \end{macrocode}
9831 % \end{macro}
9832 % Divisions specific to \pkg{ekdosis}. Define keys to be used by
9833 % \cs{ekddiv}:---
9834 % \begin{macrocode}
9835 \ekvdefinekeys{ekd@div}{
9836 code type = \def\type@value{#1},
9837 code n = \def\n@value{#1},
9838 code head = \def\head@value{#1},
9839 code barehead = \def\barehead@value{#1},
9840 store depth = \depth@value,
9841 code mark = \ekd@storemark{#1},
9842 choice toc = {book = \def\toc@value{book},
9843 part = \def\toc@value{part},
9844 chapter = \def\toc@value{chapter},
9845 section = \def\toc@value{section},
9846 subsection = \def\toc@value{subsection},
9847 subsubsection = \def\toc@value{subsubsection},
9848 paragraph = \def\toc@value{paragraph},
9849 subparagraph = \def\toc@value{subparagraph}},
9850 unknown-choice toc = \PackageError{ekdosis}{unknown toc=#1}{`toc'
9851 must be either `book', `part', `chapter', `section', `subsection',
9852 \MessageBreak `subsubsection', `paragraph' or `subparagraph'.},
9853 initial depth = 1
9854 }
9855 % \end{macrocode}
9856 % \begin{macro}{\FormatDiv}
9857 % \cs{FormatDiv}\marg{n}\marg{code before}\marg{code
9858 % after} is used to lay out the heading of the title. It takes three
9859 % mandatory arguments: \emph{n}, namely the number referring to the
9860 % particular depth of the division, and then some \LaTeX{} formatting
9861 % commands to go before and after the heading itself:---
9862 % \begin{macrocode}
9863 \NewDocumentCommand{\FormatDiv}{m m m}{
9864 \luadirect{ekdosis.fmtdiv(\luastring{#1},
9865 \luastringN{#2},
9866 \luastringN{#3})}
9867 }
9868 % \end{macrocode}
9869 % \end{macro}
9870 % \cs{ekd@getfmtdiv} gets the formatting commands that have been
9871 % stored by \cs{FormatDiv}.
9872 % \begin{macrocode}
9873 \NewDocumentCommand{\ekd@getfmtdiv}{m m}{%
9874 \luadirect{tex.sprint(ekdosis.getfmtdiv(\luastringO{#1},
9875 \luastringN{#2}))}%
9876 }
9877 % \end{macrocode}
9878 % \begin{macro}{\ekddiv}
9879 % \cs{ekddiv}\marg{key-value arguments} is the standard command
9880 % provided by \pkg{ekdosis} to meet the requirements of classical and
9881 % literary texts the divisions of which depend on many different
9882 % received traditions. It takes one mandatory argument in which the
9883 % key-value arguments defined above are accepted, and converts the
9884 % divisions into \texttt{TEI} \enquote*{un-numbered} |<div>|
9885 % elements.
9886 % \begin{macrocode}
9887 \NewDocumentCommand{\ekddiv}{m}{
9888 \begingroup
9889 \ekvset{ekd@div}{#1}%
9890 \ifdefined\head@value
9891 \bgroup
9892 \ekd@getfmtdiv{\depth@value}{b}%
9893 \head@value
9894 \ekd@getfmtdiv{\depth@value}{e}%
9895 \egroup
9896 \ifdefined\toc@value
9897 \ltx@ifpackageloaded{hyperref}{\phantomsection}{}%
9898 \ifdefined\barehead@value
9899 \addcontentsline{toc}{\toc@value}{\barehead@value}%
9900 \else
9901 \addcontentsline{toc}{\toc@value}{\head@value}%
9902 \fi
9903 \fi
9904 \fi
9905 \endgroup
9906 }
9907 % \end{macrocode}
9908 % \end{macro}
9909 % \paragraph{Poetry Settings}
9910 % \begin{environment}{ekdverse}
9911 % \env{ekdverse} provides an implementation of poetry lines. It is
9912 % set to use either the \pkg{lineno} or the \pkg{verse} package
9913 % depending on the value that is passed to the global option
9914 % |poetry|.
9915 % \begin{macro}{\test@vpnum}
9916 % \cs{test@vpnum} is used internally when |ekdosis| needs to know
9917 % whether two subsequent lines are printed on the same page or not.
9918 % \begin{macrocode}
9919 \newif\ifekd@test@vpnum
9920 \newcounter{ekd@vpnum}
9921 \globalcounter{ekd@vpnum}
9922 \NewDocumentCommand{\test@vpnum}{}{%
9923 \ifekd@test@vpnum
9924 \edef\@tempa{\theekd@vpnum}%
9925 \stepcounter{ekd@vpnum}%
9926 \label{vpnum:\theekd@vpnum}%
9927 \ifnum
9928 \pdf@strcmp{\getpagerefnumber{vpnum:\@tempa}}%
9929 {\getpagerefnumber{vpnum:\theekd@vpnum}}
9930 = 0
9931 \else
9932 \resetvlinenumber
9933 \fi
9934 \else
9935 \label{vpnum:\theekd@vpnum}%
9936 \global\ekd@test@vpnumtrue
9937 \fi
9938 }
9939 % \end{macrocode}
9940 % \end{macro}
9941 % \begin{macro}{\\+}
9942 % \changes{v1.4}{2021/11/21}{New macro for poetry}
9943 % |\\+| comes in addition to the verse commands that are provided by
9944 % the \pkg{verse} package. |\\+| causes a linebreak within a verse
9945 % line. In contrast to |\\>|, the subsequent line is not indented and
9946 % complies to any already defined indent pattern. \cs{@vscentercr}
9947 % must be redefined accordingly.
9948 % \begin{macrocode}
9949 \ifboolexpr{bool {@pkg@poetry@verse} or bool {ekd@memoir@loaded}}
9950 {\newcommand{\@vsifplus}[1]{\@ifnextchar +{\@firstoftwo{#1}}}
9951 \renewcommand{\@vscentercr}{%
9952 \ifhmode \unskip\else \@nolnerr\fi
9953 \@vsifgt{\ifnum@brokenline\@vstypelinenum\fi\verselinebreak}{%
9954 \@vsifplus{\ifnum@brokenline\@vstypelinenum\fi\stepcounter{vslineno}%
9955 \par\@ifstar{\nobreak\@vsxcentercr}{%
9956 \@vsifbang{\@ifnextchar[ {\@vsicentercr}{}}{\@vsxcentercr}%
9957 }%
9958 }{%
9959 \@vstypelinenum
9960 \incr@vsline%
9961 \par\@ifstar{\nobreak\@vsxcentercr}{%
9962 \@vsifbang{\@ifnextchar[ {\@vsicentercr}{}}{\@vsxcentercr}%
9963 }%
9964 }%
9965 }%
9966 }
9967 }{}
9968 % \end{macrocode}
9969 % \end{macro}
9970 % A small patch is applied to the \pkg{verse} package, then
9971 % \env{ekdverse} is defined:---
9972 % \begin{macrocode}
9973 \if@pkg@poetry@verse
9974 \patchcmd{\start@vsline}{%
9975 \ifaltindent}{%
9976 \ifekd@pagevlineation\test@vpnum\fi
9977 \ifaltindent}{}{}
9978 \ekvdefinekeys{ekd@verse}{
9979 dimen width = \vwidth@val,
9980 initial width = \linewidth,
9981 code type = \def\type@value{#1},
9982 }
9983 \ifekd@memoir@loaded
9984 \def\vlvnumfont{\normalfont\footnotesize}
9985 \def\verselinenumfont#1{\def\vlvnumfont{#1}}
9986 \else
9987 \verselinenumfont{\normalfont\footnotesize}
9988 \fi
9989 \setcounter{poemline}{1}
9990 \NewDocumentEnvironment{ekdverse}{!O{}}{%
9991 \ekvset{ekd@verse}{#1}%
9992 \if@continuous@vnum\setverselinenums{\thelinenumber}{0}\fi
9993 \nolinenumbers
9994 \let\linelabel\label
9995 \ifekd@memoir@loaded
9996 \refstepcounter{verse}%
9997 \else
9998 \stepcounter{verse@envctr}%
9999 \fi
10000 \addtocounter{poemline}{-1}\refstepcounter{poemline}%
10001 \setcounter{vslineno}{1}%
10002 \let\\=\@vscentercr
10003 \list{}{\itemsep \z@
10004 \itemindent -\vindent%
10005 \listparindent\itemindent
10006 \parsep \stanzaskip
10007 \setlength{\itemsep}{0pt}%
10008 \setlength{\topsep}{0pt}%
10009 \setlength{\partopsep}{0pt}%
10010 \ifdim\vwidth@val < \linewidth
10011 \rightmargin \z@
10012 \setlength{\leftmargin}{\linewidth}%
10013 \addtolength{\leftmargin}{-\vwidth@val}%
10014 \addtolength{\leftmargin}{-0.5\leftmargin}%
10015 \else
10016 \rightmargin \leftmargin
10017 \fi
10018 \addtolength{\leftmargin}{\vindent}}%
10019 \item[]\ifekd@pagevlineation\test@vpnum\fi%
10020 }
10021 {\endlist
10022 \if@continuous@vnum\resetlinenumber[\thepoemline]\fi}
10023 % \end{macrocode}
10024 % Finally, this is the standard \env{verse} environment:---
10025 % \begin{macrocode}
10026 \else
10027 \newlength{\ekdverseindentlength}
10028 \setlength{\ekdverseindentlength}{\parindent}
10029 \NewDocumentEnvironment{ekdverse}{!O{\ekdverseindentlength}}{
10030 \begin{list}{}{%
10031 \setlength{\leftmargin}{#1}
10032 \setlength{\itemsep}{0pt}
10033 \setlength{\topsep}{0pt}
10034 \setlength{\partopsep}{0pt}
10035 }
10036 \item[]
10037 }{\end{list}}
10038 \fi
10039 % \end{macrocode}
10040 % \end{environment}
10041 % \begin{macro}{\resetvlinenumber}
10042 % \changes{v1.2}{2021/04/02}{resets line numbers in poetry environments}
10043 % This command is the equivalent of \cs{resetlinenumber} for lines of
10044 % poetry. It takes an integer as optional argument, which is |1| by
10045 % default.
10046 % \begin{macrocode}
10047 \NewDocumentCommand{\resetvlinenumber}{O{1}}{%
10048 \if@pkg@poetry@verse
10049 \setverselinenums{#1}{0}%
10050 \fi
10051 }
10052 % \end{macrocode}
10053 % \end{macro}
10054 % \begin{environment}{ekdstanza}
10055 % \changes{v1.2}{2021/04/02}{new environment for stanzas}
10056 % \env{ekdstanza} is needed when lines are grouped into stanzas,
10057 % which can be further named by means of the |type| optional
10058 % argument:---
10059 % \begin{macrocode}
10060 \ekvdefinekeys{ekd@stanza}{
10061 code type = \def\type@value{#1}
10062 }
10063 \NewDocumentEnvironment{ekdstanza}{!O{}}{%
10064 \leavevmode\unskip
10065 \ekvset{ekd@stanza}{#1}%
10066 \ignorespaces
10067 }{}
10068 % \end{macrocode}
10069 % \end{environment}
10070 % \begin{environment}{ekdpar}
10071 % When |autopar| is set to |false| by means of \cs{SetTEIxmlExport},
10072 % \env{ekdpar}\---or any other environment set to be inserted within
10073 % |<p>| elements\---must be used so that \pkg{ekdosis} can be
10074 % informed of paragraph boundaries.
10075 % \begin{macrocode}
10076 \NewDocumentEnvironment{ekdpar}{}{\par}{\par}
10077 % \end{macrocode}
10078 % \end{environment}
10079 % \paragraph{Configuration File} Finally, if a configuration file
10080 % named |\jobname-ekd.cfg| can be found, this file is read and its
10081 % contents loaded into the document preamble. This provides a
10082 % convenient way to gather all the settings related to the critical
10083 % edition in a separate file.
10084 % \begin{macrocode}
10085 \IfFileExists{\jobname-ekd.cfg}{\input{\jobname-ekd.cfg}}{}
10086 % \end{macrocode}
10087 % \iffalse
10088 %</package>
10089 % \fi
10090 %
10091 % \Finale
10092 % \iffalse
10093 %<*lua>
10094 % \fi
10095 % \begin{comment}
10096 % \begin{ekdlua}
10097 -- `'
10098 -- This table will hold the functions:
10099 ekdosis = {}
10100
10101 -- lpeg equivalent for string.gsub()
10102 local function gsub(s, patt, repl)
10103 patt = lpeg.P(patt)
10104 patt = lpeg.Cs((patt / repl + 1)^0)
10105 return lpeg.match(patt, s)
10106 end
10107
10108 -- some basic patterns:
10109 local letters = lpeg.R("az", "AZ")
10110 local ascii = lpeg.R("az", "AZ", "@@")
10111 local dblbkslash = lpeg.Cs("\\")
10112 local bsqbrackets = lpeg.Cs{ "[" * ((1 - lpeg.S"[]") + lpeg.V(1))^0 * "]" }
10113 local bcbraces = lpeg.Cs{ "{" * ((1 - lpeg.S"{}") + lpeg.V(1))^0 * "}" }
10114 local spce = lpeg.Cs(" ")
10115 local spcenc = lpeg.P(" ")
10116 local cmdstar = lpeg.Cs(spce * lpeg.P("*"))
10117 local bsqbracketsii = lpeg.Cs(bsqbrackets^-2)
10118 local bcbracesii = lpeg.Cs(bcbraces^-2)
10119 local cmd = lpeg.Cs(dblbkslash * ascii^1 * cmdstar^-1)
10120 local rawcmd = lpeg.Cs(dblbkslash * ascii^1)
10121 local aftercmd = lpeg.Cs(lpeg.S("*[{,.?;:'`\"") + dblbkslash)
10122 local cmdargs = lpeg.Cs(spce^-1 * bsqbracketsii * bcbracesii * bsqbrackets^-1)
10123 local app = lpeg.Cs("app")
10124 local lemrdg = lpeg.Cs(lpeg.Cs("lem") + lpeg.Cs("rdg"))
10125 local note = lpeg.Cs("note")
10126 local inlem = lpeg.Cs{ "<lem" * ((1 - (lpeg.P"<lem" + lpeg.P"</lem>")) + lpeg.V(1))^0 * "</lem>" }
10127 local inanchor = lpeg.Cs{ "<anchor" * ((1 - (lpeg.P"<" + lpeg.P">")) + lpeg.V(1))^0 * ">" }
10128 local inopeningnote = lpeg.Cs{ "<note" * ((1 - (lpeg.P"<" + lpeg.P">")) + lpeg.V(1))^0 * ">" }
10129 local lnbrk = lpeg.Cs("\\\\")
10130 local poemline = lpeg.Cs(lnbrk * spcenc^-1 * lpeg.S("*!")^-1 * bsqbrackets^-1 * spcenc^-1)
10131 local poemlinebreak = lpeg.Cs(lnbrk * spcenc^-1 * (lpeg.P("&gt;") + lpeg.P("+")) * bsqbrackets^-1 * spcenc^-1)
10132 local linegroup = lpeg.Cs{ "<lg" * ((1 - lpeg.S"<>") + lpeg.V(1))^0 * ">" }
10133 local bclinegroup = lpeg.Cs(linegroup + lpeg.P("</lg>"))
10134 local endpoem = lpeg.Cs(lnbrk * lpeg.S("*!") * bsqbrackets^-1) -- not used
10135 local sections = lpeg.Cs(lpeg.P("book") + lpeg.P("part") + lpeg.P("chapter")
10136 + lpeg.P("section") + lpeg.P("subsection")
10137 + lpeg.P("subsubsection"))
10138 local par = lpeg.P(lpeg.P("\\par") * spce^0)
10139 local parb = lpeg.P(lpeg.P("\\p@rb") * spce^0)
10140 local para = lpeg.P(lpeg.P("\\p@ra") * spce^0)
10141 local labelrefcmds = lpeg.Cs(lpeg.P("label")
10142 + lpeg.P("linelabel")
10143 + lpeg.P("lineref")
10144 + lpeg.P("ref")
10145 + lpeg.P("pageref")
10146 + lpeg.P("vref")
10147 + lpeg.P("vpageref"))
10148 local citecmds = lpeg.Cs(lpeg.P("icite")
10149 + lpeg.P("cite")
10150 + lpeg.P("Cite")
10151 + lpeg.P("cite *")
10152 + lpeg.P("parencite")
10153 + lpeg.P("Parencite")
10154 + lpeg.P("parencite *")
10155 + lpeg.P("footcite")
10156 + lpeg.P("footcitetext")
10157 + lpeg.P("textcite")
10158 + lpeg.P("Textcite")
10159 + lpeg.P("smartcite")
10160 + lpeg.P("Smartcite")
10161 + lpeg.P("autocite")
10162 + lpeg.P("Autocite")
10163 + lpeg.P("autocite *")
10164 + lpeg.P("Autocite *")
10165 )
10166 --
10167 -- Bind to local variables
10168 local next = next
10169
10170 -- General
10171 local xmlids = {}
10172 table.insert(xmlids, {xmlid = "scholars"} )
10173
10174 local function xmlidfound(element)
10175 for i = 1,#xmlids do
10176 if xmlids[i].xmlid == element then
10177 return true
10178 end
10179 end
10180 return false
10181 end
10182
10183 local function checkxmlid(str)
10184 if string.find(str, "^[0-9]")
10185 or string.find(str, "[%{%}%[%]%(%):; ]")
10186 then
10187 return false
10188 else
10189 return true
10190 end
10191 end
10192
10193 -- Witnesses
10194 local listWit = {}
10195 -- Persons/Scholars
10196 local listPerson = {}
10197
10198 local idsRend = {}
10199 local shorthands = {}
10200
10201 local function isfound(table, value)
10202 for i = 1,#table do
10203 if table[i] == value then
10204 return true
10205 end
10206 end
10207 return false
10208 end
10209
10210 local function isintable(table, value)
10211 for i = 1,#table do
10212 if table[i].a == value then
10213 return true
10214 end
10215 end
10216 return false
10217 end
10218
10219 local function get_a_index(id, table)
10220 local idfound = nil
10221 for i = 1,#table
10222 do
10223 if table[i].a == id then
10224 idfound = i
10225 break
10226 end
10227 end
10228 return idfound
10229 end
10230
10231 local function getindex(id, table)
10232 local idfound = nil
10233 for i = 1,#table
10234 do
10235 if table[i].xmlid == id then
10236 idfound = i
10237 break
10238 end
10239 end
10240 return idfound
10241 end
10242
10243 function ekdosis.newwitness(id,
10244 siglum,
10245 description,
10246 Settlement,
10247 Institution,
10248 Repository,
10249 Collection,
10250 Idno,
10251 MsName,
10252 OrigDate,
10253 Locus)
10254 if xmlidfound(id)
10255 then
10256 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
10257 ..id..
10258 "\" already exists as an xml:id. "
10259 ..
10260 "Please pick another id.}}")
10261 elseif not checkxmlid(id)
10262 then
10263 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
10264 ..id..
10265 "\" is not a valid xml:id. \\MessageBreak "
10266 ..
10267 "Please pick another id.}}")
10268 else
10269 table.insert(xmlids, {xmlid = id})
10270 table.sort(xmlids, function(a ,b) return(#a.xmlid > #b.xmlid) end)
10271 table.insert(idsRend, {xmlid = id, abbr = siglum})
10272 table.sort(idsRend, function(a ,b) return(#a.xmlid > #b.xmlid) end)
10273 table.insert(listWit, {xmlid = id,
10274 abbr = siglum,
10275 detailsDesc = description,
10276 msIdentifier = {
10277 settlement = Settlement,
10278 institution = Institution,
10279 repository = Repository,
10280 collection = Collection,
10281 idno = Idno,
10282 msName = MsName}
10283 })
10284 local indexwit = getindex(id, listWit)
10285 if OrigDate ~= "" then
10286 listWit[indexwit].history = {}
10287 listWit[indexwit].history.origin = {origDate = OrigDate}
10288 end
10289 if Locus ~= "" then
10290 listWit[indexwit].msContents = {}
10291 listWit[indexwit].msContents.msItemStruct = {locus = Locus}
10292 end
10293 end
10294 return true
10295 end
10296
10297 function ekdosis.newhand(id, witid, siglum, description)
10298 if xmlidfound(id) or not xmlidfound(witid)
10299 then
10300 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
10301 ..id..
10302 "\" already exists as an xml:id. "
10303 ..
10304 "Please pick another id.}}")
10305 elseif not checkxmlid(id)
10306 then
10307 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
10308 ..id..
10309 "\" is not a valid xml:id. \\MessageBreak "
10310 ..
10311 "Please pick another id.}}")
10312 else
10313 table.insert(xmlids, {xmlid = id})
10314 table.sort(xmlids, function(a ,b) return(#a.xmlid > #b.xmlid) end)
10315 table.insert(idsRend, {xmlid = id, abbr = siglum})
10316 table.sort(idsRend, function(a ,b) return(#a.xmlid > #b.xmlid) end)
10317 local indexwit = getindex(witid, listWit)
10318 -- listWit[indexwit].handDesc = {xmlid = id, abbr = siglum, handNote = description}
10319 if listWit[indexwit].handDesc == nil
10320 then
10321 listWit[indexwit].handDesc = {}
10322 else
10323 end
10324 table.insert(listWit[indexwit].handDesc,
10325 {xmlid = id, abbr = siglum, detailsDesc = description})
10326 end
10327 return true
10328 end
10329
10330 function ekdosis.newshorthand(id, rend, xmlids)
10331 if isintable(shorthands, id)
10332 then
10333 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
10334 ..id..
10335 "\" already exists as a shorthand. "
10336 ..
10337 "Please pick another shorthand.}}")
10338 else
10339 table.insert(shorthands, { a = id, b = rend, c = xmlids })
10340 table.sort(shorthands, function(a ,b) return(#a.a > #b.a) end)
10341 table.insert(idsRend, {xmlid = id, abbr = rend})
10342 table.sort(idsRend, function(a ,b) return(#a.xmlid > #b.xmlid) end)
10343 end
10344 return true
10345 end
10346
10347 function ekdosis.newscholar(id,
10348 siglum,
10349 rawname,
10350 Forename,
10351 Surname,
10352 AddName,
10353 Note)
10354 if xmlidfound(id)
10355 then
10356 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
10357 ..id..
10358 "\" already exists as an xml:id. "
10359 ..
10360 "Please pick another id.}}")
10361 elseif not checkxmlid(id)
10362 then
10363 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
10364 ..id..
10365 "\" is not a valid xml:id. \\MessageBreak "
10366 ..
10367 "Please pick another id.}}")
10368 else
10369 table.insert(xmlids, {xmlid = id})
10370 table.sort(xmlids, function(a ,b) return(#a.xmlid > #b.xmlid) end)
10371 table.insert(idsRend, {xmlid = id, abbr = siglum})
10372 table.sort(idsRend, function(a ,b) return(#a.xmlid > #b.xmlid) end)
10373 if rawname ~= ""
10374 then
10375 table.insert(listPerson, {xmlid = id,
10376 abbr = siglum,
10377 note = Note,
10378 persName = {
10379 name = rawname}
10380 })
10381 else
10382 table.insert(listPerson, {xmlid = id,
10383 abbr = siglum,
10384 note = Note,
10385 persName = {
10386 forename = Forename,
10387 surname = Surname,
10388 addName = AddName}
10389 })
10390 end
10391 end
10392 return true
10393 end
10394
10395 local xmlbibresource = nil
10396
10397 function ekdosis.addxmlbibresource(str)
10398 if string.find(str, "%.xml$")
10399 then
10400 xmlbibresource = str
10401 else
10402 xmlbibresource = str..".xml"
10403 end
10404 return true
10405 end
10406
10407 function ekdosis.newsource(id, siglum)
10408 if xmlidfound(id)
10409 then
10410 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
10411 ..id..
10412 "\" already exists as an xml:id. "
10413 ..
10414 "Please pick another id.}}")
10415 elseif not checkxmlid(id)
10416 then
10417 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
10418 ..id..
10419 "\" is not a valid xml:id. \\MessageBreak "
10420 ..
10421 "Please pick another id.}}")
10422 else
10423 table.insert(xmlids, {xmlid = id})
10424 table.sort(xmlids, function(a ,b) return(#a.xmlid > #b.xmlid) end)
10425 table.insert(idsRend, {xmlid = id, abbr = siglum})
10426 table.sort(idsRend, function(a ,b) return(#a.xmlid > #b.xmlid) end)
10427 end
10428 return true
10429 end
10430
10431 local familysep = nil
10432
10433 function ekdosis.setfamilysep(str)
10434 if str == "reset"
10435 then
10436 familysep = nil
10437 else
10438 familysep = str
10439 end
10440 return true
10441 end
10442
10443 function ekdosis.getsiglum(str, opt)
10444 str = str..","
10445 str = string.gsub(str, "%s-(%,)", "%1")
10446 ctrl = str
10447 if opt == "tei" then
10448 for i = 1,#shorthands do
10449 local tempa = string.gsub(shorthands[i].a, "([%-%.%_])", "%%%1")
10450 str = string.gsub(str, tempa, shorthands[i].c)
10451 end
10452 for i = 1,#idsRend do
10453 local tempb = string.gsub(idsRend[i].xmlid, "([%-%.%_])", "%%%1")
10454 str = string.gsub(str, "(%f[%w%-%.%_])"..tempb.."(%,)",
10455 "%1#"..idsRend[i].xmlid.."%2")
10456 ctrl = string.gsub(ctrl, tempb.."%,", "")
10457 end
10458 str = string.gsub(str, "%,(%s-)([%#])", " %2")
10459 str = string.gsub(str, "%,$", "")
10460 else
10461 for i = 1,#idsRend do
10462 local tempc = string.gsub(idsRend[i].xmlid, "([%-%.%_])", "%%%1")
10463 str = string.gsub(str, tempc.."%,", idsRend[i].abbr)
10464 ctrl = string.gsub(ctrl, tempc.."%,", "")
10465 end
10466 if familysep ~= nil
10467 then
10468 str = string.gsub(str, "%s+", familysep)
10469 end
10470 end
10471 -- if string.find(ctrl, "[A-Za-z0-9]")
10472 if string.find(ctrl, "%S")
10473 then
10474 return "<??>"
10475 else
10476 return str
10477 end
10478 end
10479
10480 -- begin totei functions
10481
10482 local cmdtotags = {
10483 {a="textsuperscript", b="hi", c=" rend=\"sup\""},
10484 {a="textsubscript", b="hi", c=" rend=\"sub\""},
10485 {a="LRfootnote", b="note", c=" place=\"bottom\""},
10486 {a="RLfootnote", b="note", c=" place=\"bottom\""},
10487 {a="enquote *", b="quote", c=""},
10488 {a="marginpar", b="note", c=" place=\"margin\""},
10489 {a="footnote", b="note", c=" place=\"bottom\""},
10490 {a="enquote", b="quote", c=""},
10491 {a="prname *", b="span",
10492 c=" xml:lang=\"ar-Latn\" type=\"transliterated\""},
10493 {a="prname", b="span",
10494 c=" xml:lang=\"ar-Latn\" type=\"transliterated\" subtype=\"arabtex\""},
10495 {a="txtrans", b="s", c=" xml:lang=\"ar-Latn\" type=\"transliterated\""},
10496 {a="textbf", b="hi", c=" rend=\"bold\""},
10497 {a="textit", b="hi", c=" rend=\"italic\""},
10498 {a="textsc", b="hi", c=" rend=\"smallcaps\""},
10499 {a="textsf", b="hi", c=" rend=\"sf\""},
10500 {a="arbup", b="hi", c=" rend=\"sup\""},
10501 {a="txarb", b="foreign", c=" xml:lang=\"arb\""},
10502 {a="arb", b="span",
10503 c=" xml:lang=\"ar-Latn\" type=\"transliterated\" subtype=\"arabtex\""}
10504 }
10505
10506 local texpatttotags = {
10507 {a="\\addentries%s+%[(.-)%]{(.-)}", b=""},
10508 {a="\\addentries%s+{(.-)}", b=""},
10509 {a="\\vmodulolinenumbers%s+%[(.-)%]", b=""},
10510 {a="\\vmodulolinenumbers%s+", b=""},
10511 {a="\\modulolinenumbers%s+%[(.-)%]", b=""},
10512 {a="\\modulolinenumbers%s+", b=""},
10513 {a="\\setverselinenums%s+{(.-)}{(.-)}", b=""},
10514 {a="\\resetvlinenumber%s+%[(.-)%]", b=""},
10515 {a="\\resetvlinenumber%s+", b=""},
10516 {a="\\resetlinenumber%s+%[(.-)%]", b=""},
10517 {a="\\resetlinenumber%s+", b=""},
10518 {a="\\ekdresethfmarks%s+", b=""},
10519 {a="\\indentpattern%s+{(.-)}", b=""},
10520 {a="\\ekdnohfmark%s+", b=""},
10521 {a="\\settowidth%s+{(.-)}{(.-)}", b=""},
10522 {a="\\poemlines%s+{(.-)}", b=""},
10523 {a="\\pagebreak%s+%[[1-4]%]", b=""},
10524 {a="\\pagebreak%s+", b=""},
10525 {a="\\teidirect%s+(%b[]){(.-)}(%b{})", b="<%2 ekd@os%1ekd@cs>ekd@ob%3ekd@cb</%2>"},
10526 {a="\\teidirect%s+{(.-)}(%b{})", b="<%1>ekd@ob%2ekd@cb</%1>"},
10527 {a="\\altrfont%s+", b=""},
10528 {a="\\endmark%s+", b=""},
10529 {a="\\ekdpb%s+%*?%[(.-)%]{(.-)}", b=""},
10530 {a="\\ekdpb%s+%*?{(.-)}", b=""},
10531 {a="\\ekdpb%s+%*\\?", b=""},
10532 {a="\\mbox%s+(%b{})", b="ekd@ob%1ekd@cb"},
10533 {a="\\LR%s+(%b{})", b="ekd@ob%1ekd@cb"},
10534 {a="\\RL%s+(%b{})", b="ekd@ob%1ekd@cb"},
10535 {a="\\%=%=%=%s?", b="—"},
10536 {a="\\%-%-%-%s?", b="—"},
10537 {a="\\%=%=%s?", b="–"},
10538 {a="\\%-%-%s?", b="–"},
10539 {a="\\%=%/%s?", b="‐"},
10540 {a="\\%-%/%s?", b="‐"},
10541 {a="\\vin%s+", b=""},
10542 {a="\\uc%s+(%b{})", b="ekd@ob%1ekd@cb"}
10543 }
10544
10545 local envtotags = {
10546 {a="flushright", b="p", c=" rend=\"align(right)\""},
10547 {a="flushleft", b="p", c=" rend=\"align(left)\""},
10548 {a="quotation", b="quote", c=""},
10549 {a="txarabtr", b="p", c=" xml:lang=\"ar-Latn\" type=\"transliterated\""},
10550 {a="quoting", b="quote", c=""},
10551 {a="ekdpar", b="p", c=""},
10552 {a="txarab", b="p", c=" xml:lang=\"arb\""},
10553 {a="center", b="p", c=" rend=\"align(center)\""},
10554 {a="arab", b="p",
10555 c=" xml:lang=\"ar-Latn\" type=\"transliterated\" subtype=\"arabtex\""}
10556 }
10557
10558 local close_p = {
10559 "p",
10560 "lg"
10561 }
10562
10563 local forbid_xmlid = true
10564
10565 function ekdosis.newcmdtotag(cmd, tag, attr)
10566 if forbid_xmlid
10567 then
10568 attr = string.gsub(attr, "xml:id", "n") -- xml:id is not allowed here
10569 else
10570 end
10571 if isintable(cmdtotags, cmd)
10572 then
10573 local index = get_a_index(cmd, cmdtotags)
10574 table.remove(cmdtotags, index)
10575 table.insert(cmdtotags, {a = cmd, b = tag, c = " "..attr})
10576 table.sort(cmdtotags, function(a ,b) return(#a.a > #b.a) end)
10577 else
10578 table.insert(cmdtotags, {a = cmd, b = tag, c = " "..attr})
10579 table.sort(cmdtotags, function(a ,b) return(#a.a > #b.a) end)
10580 end
10581 return true
10582 end
10583
10584 function ekdosis.newpatttotag(pat, repl)
10585 pat = string.gsub(pat, "([%[%]])", "%%%1")
10586 pat = string.gsub(pat, "%@b[1-9]", "(%%b{})")
10587 pat = string.gsub(pat, "%@s[1-9]", "(%%b[])")
10588 pat = string.gsub(pat, "%#[1-9]", "(.-)")
10589 repl = string.gsub(repl, "%#([1-9])", "%%%1")
10590 repl = string.gsub(repl, "%@b([1-9])", "ekd@ob%%%1ekd@cb")
10591 repl = string.gsub(repl, "%@s([1-9])", "ekd@os%%%1ekd@cs")
10592 if isintable(texpatttotags, pat)
10593 then
10594 local index = get_a_index(pat, texpatttotags)
10595 table.remove(texpatttotags, index)
10596 table.insert(texpatttotags, { a = pat, b = repl })
10597 table.sort(texpatttotags, function(a ,b) return(#a.a > #b.a) end)
10598 else
10599 table.insert(texpatttotags, { a = pat, b = repl })
10600 table.sort(texpatttotags, function(a ,b) return(#a.a > #b.a) end)
10601 end
10602 return true
10603 end
10604
10605 function ekdosis.newenvtotag(env, tag, attr, closep)
10606 if forbid_xmlid
10607 then
10608 attr = string.gsub(attr, "xml:id", "n") -- xml:id is not allowed here
10609 else
10610 end
10611 if isintable(envtotags, env)
10612 then
10613 local index = get_a_index(env, envtotags)
10614 table.remove(envtotags, index)
10615 table.insert(envtotags, {a = env, b = tag, c = " "..attr, d = closep})
10616 table.sort(envtotags, function(a ,b) return(#a.a > #b.a) end)
10617 else
10618 table.insert(envtotags, {a = env, b = tag, c = " "..attr, d = closep})
10619 table.sort(envtotags, function(a ,b) return(#a.a > #b.a) end)
10620 end
10621 return true
10622 end
10623
10624 -- Get values of attributes
10625 local function get_attr_value(str, attr)
10626 str = str..","
10627 str = string.gsub(str, "%b{}", function(body)
10628 body = string.gsub(body, attr, attr.."@ekd")
10629 return string.format("%s", body)
10630 end)
10631 local attrval = string.match(str, "%f[%w]"..attr.."%s?%=%s?%b{}")
10632 or string.match(str, "%f[%w]"..attr.."%s?%=%s?.-%,")
10633 or ""
10634 attrval = string.gsub(attrval, attr.."%s?%=%s?(%b{})", function(bbraces)
10635 bbraces = string.sub(bbraces, 2, -2)
10636 return string.format("%s", bbraces)
10637 end)
10638 attrval = string.gsub(attrval, attr.."%s?%=%s?(.-)%s?%,", "%1")
10639 str = string.gsub(str, attr.."@ekd", attr)
10640 return attrval
10641 end
10642
10643 local function xml_entities(str)
10644 str = string.gsub(str, "%<", "&lt;")
10645 str = string.gsub(str, "%>", "&gt;")
10646 return str
10647 end
10648
10649 local function note_totei(str)
10650 str = gsub(str,
10651 dblbkslash *
10652 note *
10653 spcenc^-1 *
10654 bsqbrackets *
10655 bcbraces *
10656 spcenc^-1,
10657 function(bkslash, cmd, opt, arg)
10658 opt = string.sub(opt, 2, -2)
10659 arg = string.sub(arg, 2, -2)
10660 teitype = get_attr_value(opt, "type")
10661 if teitype ~= "" then teitype = " type=\""..teitype.."\"" else end
10662 right = get_attr_value(opt, "labelb")
10663 left = get_attr_value(opt, "labele")
10664 if right == ""
10665 then
10666 return string.format("<%s>%s</%s>", cmd, arg, cmd)
10667 else
10668 if left ~= ""
10669 then
10670 return string.format(
10671 "<%s%s target=\"#range(right(%s),left(%s))\">%s</%s><anchor xml:id=\"%s\"/>",
10672 cmd, teitype, right, left, arg, cmd, right)
10673 elseif left == ""
10674 then
10675 return string.format(
10676 "<%s%s target=\"#right(%s)\">%s</%s><anchor xml:id=\"%s\"/>",
10677 cmd, teitype, right, arg, cmd, right)
10678 end
10679 end
10680 end)
10681 return str
10682 end
10683
10684 local function remove_extra_anchors(str)
10685 str = gsub(str, lpeg.Cs("</note>") * inanchor * inopeningnote, function(enote, anchor, bnote)
10686 local id_one = string.gsub(anchor, "(%<anchor )(.-)(/%>)", "%2")
10687 id_one = string.sub(get_attr_value(id_one, "xml:id"), 2, -2)
10688 local id_two = string.match(bnote, "target%=.-right%((.-)%)")
10689 id_two = string.gsub(id_two, ".-right%((.-)%)", "%1")
10690 if id_one == id_two
10691 then
10692 return string.format("%s%s", enote, bnote)
10693 else
10694 return string.format("%s%s%s", enote, anchor, bnote)
10695 end
10696 end)
10697 return str
10698 end
10699
10700 local function app_totei(str)
10701 str = gsub(str,
10702 dblbkslash *
10703 app *
10704 spcenc^-1 *
10705 bsqbrackets *
10706 bcbraces *
10707 spcenc^-1,
10708 function(bkslash, cmd, opt, arg)
10709 opt = string.sub(opt, 2, -2)
10710 arg = string.sub(arg, 2, -2)
10711 opt = get_attr_value(opt, "type")
10712 if opt ~= "" then opt = " type=\""..opt.."\"" else end
10713 return app_totei(string.format("<%s%s>%s</%s>",
10714 cmd, opt, arg, cmd))
10715 end)
10716 return str
10717 end
10718
10719 local function rdgGrp_totei(str)
10720 str = gsub(str,
10721 dblbkslash *
10722 lpeg.Cs("rdgGrp") *
10723 spcenc^-1 *
10724 bsqbrackets *
10725 bcbraces *
10726 spcenc^-1,
10727 function(bkslash, cmd, opt, arg)
10728 opt = string.sub(opt, 2, -2)
10729 arg = string.sub(arg, 2, -2)
10730 teitype = get_attr_value(opt, "type")
10731 if teitype ~= "" then teitype = " type=\""..teitype.."\"" else end
10732 if opt == ""
10733 then
10734 return rdgGrp_totei(string.format("<%s>%s</%s>",
10735 cmd, arg, cmd))
10736 else
10737 return rdgGrp_totei(string.format("<%s%s>%s</%s>",
10738 cmd, teitype, arg, cmd))
10739 end
10740 end)
10741 return str
10742 end
10743
10744 local function lem_rdg_totei(str)
10745 str = gsub(str,
10746 spcenc^-1 *
10747 dblbkslash *
10748 lemrdg *
10749 spcenc^-1 *
10750 bsqbrackets *
10751 bcbraces *
10752 spcenc^-1,
10753 function(bkslash, cmd, opt, arg)
10754 opt = string.sub(opt, 2, -2)
10755 arg = string.sub(arg, 2, -2)
10756 -- opt = get_attr_value(opt, "wit")
10757 --
10758 teiwit = get_attr_value(opt, "wit")
10759 if teiwit ~= "" then teiwit = " wit=\""..ekdosis.getsiglum(teiwit, "tei").."\"" else end
10760 teisource = get_attr_value(opt, "source")
10761 if teisource ~= "" then teisource = " source=\""..ekdosis.getsiglum(teisource, "tei").."\"" else end
10762 teiresp = get_attr_value(opt, "resp")
10763 if teiresp ~= "" then teiresp = " resp=\""..ekdosis.getsiglum(teiresp, "tei").."\"" else end
10764 teitype = get_attr_value(opt, "type")
10765 if teitype ~= "" then teitype = " type=\""..teitype.."\"" else end
10766 --
10767 if opt == ""
10768 then
10769 return lem_rdg_totei(string.format("<%s>%s</%s>",
10770 cmd, arg, cmd))
10771 else
10772 -- opt = ekdosis.getsiglum(opt, "tei")
10773 return lem_rdg_totei(string.format("<%s%s%s%s%s>%s</%s>",
10774 cmd, teiwit, teisource, teiresp, teitype, arg, cmd))
10775 end
10776 end)
10777 str = gsub(str, spcenc^-0 * dblbkslash * lemrdg * spcenc^-1 * bcbraces * spcenc^-1,
10778 function(bkslash, cmd, arg)
10779 arg = string.sub(arg, 2, -2)
10780 return lem_rdg_totei(string.format("<%s>%s</%s>", cmd, arg, cmd))
10781 end)
10782 return str
10783 end
10784
10785 local function relocate_notes(str)
10786 str = gsub(str, inlem, function(arg)
10787 local notes = {}
10788 for i in string.gmatch(arg, "%<note.-%>.-%<%/note%>")
10789 do
10790 table.insert(notes, i)
10791 end
10792 allnotes = table.concat(notes)
10793 arg = string.gsub(arg, "%<note.->.-%<%/note%>", "")
10794 return string.format("%s%s", arg, allnotes)
10795 end)
10796 return str
10797 end
10798
10799 local function linestotei(str)
10800 if not string.find(str, "^%s?<lg")
10801 then
10802 str = "\n<l>"..str
10803 end
10804 str = gsub(str, poemline * spcenc^0 * bclinegroup, "</l>\n%2")
10805 str = gsub(str, linegroup * -(spcenc^0 * bclinegroup), "%1\n<l>")
10806 str = gsub(str, lpeg.Cs("</lg>") * -(spcenc^0 * (bclinegroup + -1)), "%1\n<l>")
10807 -- str = gsub(str, poemline * spcenc^-1 * -1, "</l>\n")
10808 str = gsub(str, poemlinebreak, "<lb/> ")
10809 -- str = gsub(str, poemline * spcenc^-1 * lpeg.Cs("<lg"), "</l>%2")
10810 -- str = gsub(str, lpeg.Cs("</lg>") * spcenc^1 * -lpeg.P("<l"), "%1\n<l>")
10811 str = gsub(str, poemline, "</l>\n<l>")
10812 return str
10813 end
10814
10815 local function stanzatotei(str)
10816 str = string.gsub(str, "\\begin%s?%{ekdstanza%}(%b[])(.-)\\end%s?%{ekdstanza%}", function(opt, arg)
10817 arg = string.gsub(arg, "\\par%s?", "")
10818 opt = string.sub(opt, 2, -2)
10819 teitype = get_attr_value(opt, "type")
10820 if teitype ~= "" then teitype = " type=\""..teitype.."\"" else end
10821 if opt == ""
10822 then
10823 return string.format("<lg>%s</lg>", arg)
10824 else
10825 return string.format("<lg%s>%s</lg>", teitype, arg)
10826 end
10827 end)
10828 str = string.gsub(str, "\\begin%s?%{ekdstanza%}(.-)\\end%s?%{ekdstanza%}", function(arg)
10829 arg = string.gsub(arg, "\\par%s?", "")
10830 return string.format("<lg>%s</lg>", arg)
10831 end)
10832 return str
10833 end
10834
10835 -- better use lpeg: look into this later
10836 local function versetotei(str)
10837 str = string.gsub(str, "\\begin%s?%{ekdverse%}(%b[])(.-)\\end%s?%{ekdverse%}", function(opt, arg)
10838 arg = string.gsub(arg, "\\par%s?", "")
10839 arg = string.gsub(arg, "\\begin%s?%{patverse%*?%}", "")
10840 arg = string.gsub(arg, "\\end%s?%{patverse%*?%}", "")
10841 arg = string.gsub(arg, "\\indentpattern%s?%b{}", "")
10842 opt = string.sub(opt, 2, -2)
10843 teitype = get_attr_value(opt, "type")
10844 if teitype ~= "" then teitype = " type=\""..teitype.."\"" else end
10845 if opt == ""
10846 then
10847 return "\\p@rb "..linestotei(string.format("<lg>%s</lg>", arg)).."\\p@ra "
10848 else
10849 return "\\p@rb "..linestotei(string.format("<lg%s>%s</lg>", teitype, arg)).."\\p@ra "
10850 end
10851 end)
10852 str = string.gsub(str, "\\begin%s?%{ekdverse%}(.-)\\end%s?%{ekdverse%}", function(arg)
10853 arg = string.gsub(arg, "\\par%s?", "")
10854 arg = string.gsub(arg, "\\begin%s?%{patverse%*?%}", "")
10855 arg = string.gsub(arg, "\\end%s?%{patverse%*?%}", "")
10856 arg = string.gsub(arg, "\\indentpattern%s?%b{}", "")
10857 return "\\p@rb "..linestotei(string.format("<lg>%s</lg>", arg)).."\\p@ra "
10858 end)
10859 str = string.gsub(str, "\\begin%s?%{verse%}%b[](.-)\\end%s?%{verse%}", function(arg)
10860 arg = string.gsub(arg, "\\par%s?", "")
10861 return "\\p@rb "..linestotei(string.format("<lg>%s</lg>", arg)).."\\p@ra "
10862 end)
10863 str = string.gsub(str, "\\begin%s?%{verse%}(.-)\\end%s?%{verse%}", function(arg)
10864 arg = string.gsub(arg, "\\par%s?", "")
10865 return "\\p@rb "..linestotei(string.format("<lg>%s</lg>", arg)).."\\p@ra "
10866 end)
10867 return str
10868 end
10869
10870 local function envtotei(str)
10871 for i = 1,#envtotags
10872 do
10873 if envtotags[i].b ~= ""
10874 then
10875 if isfound(close_p, envtotags[i].b) or envtotags[i].d == "yes"
10876 then
10877 str = gsub(str, lpeg.P("\\begin") * spcenc^-1 * lpeg.P("{")
10878 * lpeg.Cs(envtotags[i].a) * lpeg.P("}")
10879 * bsqbracketsii * bcbracesii * spcenc^-1,
10880 "\\p@rb <"..envtotags[i].b..envtotags[i].c..">")
10881 str = gsub(str, spcenc^-1 * lpeg.P("\\end") * spcenc^-1 * lpeg.P("{")
10882 * lpeg.Cs(envtotags[i].a) * lpeg.P("}"),
10883 "</"..envtotags[i].b..">\\p@ra ")
10884 else
10885 str = gsub(str, lpeg.P("\\begin") * spcenc^-1 * lpeg.P("{")
10886 * lpeg.Cs(envtotags[i].a) * lpeg.P("}")
10887 * bsqbracketsii * bcbracesii * spcenc^-1,
10888 "<"..envtotags[i].b..envtotags[i].c..">")
10889 str = gsub(str, spcenc^-1 * lpeg.P("\\end") * spcenc^-1 * lpeg.P("{")
10890 * lpeg.Cs(envtotags[i].a) * lpeg.P("}"),
10891 "</"..envtotags[i].b..">")
10892 end
10893 else
10894 str = gsub(str, lpeg.P("\\begin") * spcenc^-1 * lpeg.P("{")
10895 * lpeg.Cs(envtotags[i].a) * lpeg.P("}")
10896 * bsqbracketsii * bcbracesii * spcenc^-1,
10897 "")
10898 str = gsub(str, spcenc^-1 * lpeg.P("\\end") * spcenc^-1 * lpeg.P("{")
10899 * lpeg.Cs(envtotags[i].a) * lpeg.P("}"),
10900 "")
10901 end
10902 end
10903 str = gsub(str, lpeg.P("\\begin") * spcenc^-1 * lpeg.P("{")
10904 * lpeg.Cs(ascii^1) * lpeg.P("}") * bsqbracketsii
10905 * bcbracesii * spcenc^-1,
10906 "<%1>")
10907 str = gsub(str, spcenc^-1 * lpeg.P("\\end") * spcenc^-1 * lpeg.P("{")
10908 * lpeg.Cs(ascii^1) * lpeg.P("}") * bsqbracketsii
10909 * bcbracesii,
10910 "</%1>")
10911 return str
10912 end
10913
10914 local function texpatttotei(str)
10915 for i = 1,#texpatttotags do
10916 str = string.gsub(str, texpatttotags[i].a, texpatttotags[i].b)
10917 str = string.gsub(str, "ekd@ob%{", "")
10918 str = string.gsub(str, "%}ekd@cb", "")
10919 str = string.gsub(str, "ekd@os%[", "")
10920 str = string.gsub(str, "%]ekd@cs", "")
10921 end
10922 return str
10923 end
10924
10925 local function icitetotei(str)
10926 str = gsub(str, lpeg.P("\\")
10927 * citecmds
10928 * spcenc^-1
10929 * bsqbrackets
10930 * bsqbrackets
10931 * bcbraces
10932 * (bsqbrackets + bcbraces)^-1,
10933 function(cmd, pre, post, body, opt)
10934 pre = string.sub(pre, 2, -2)
10935 post = string.sub(post, 2, -2)
10936 body = string.sub(body, 2, -2)
10937 if not checkxmlid(body)
10938 then
10939 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
10940 ..body..
10941 "\" is not a valid xml:id. \\MessageBreak "
10942 ..
10943 "Please pick another id.}}")
10944 else
10945 end
10946 return string.format("%s <bibl corresp=\"#%s\"><biblScope>%s</biblScope></bibl>",
10947 pre, body, post)
10948 end)
10949 str = gsub(str, lpeg.P("\\")
10950 * citecmds
10951 * spcenc^-1
10952 * bsqbrackets
10953 * bcbraces
10954 * (bsqbrackets + bcbraces)^-1,
10955 function(cmd, post, body, opt)
10956 post = string.sub(post, 2, -2)
10957 body = string.sub(body, 2, -2)
10958 if not checkxmlid(body)
10959 then
10960 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
10961 ..body..
10962 "\" is not a valid xml:id. \\MessageBreak "
10963 ..
10964 "Please pick another id.}}")
10965 else
10966 end
10967 return string.format("<bibl corresp=\"#%s\"><biblScope>%s</biblScope></bibl>", body, post)
10968 end)
10969 str = gsub(str, lpeg.P("\\")
10970 * citecmds
10971 * spcenc^-1
10972 * bcbraces
10973 * (bsqbrackets + bcbraces)^-1,
10974 function(cmd, body, opt)
10975 body = string.sub(body, 2, -2)
10976 if not checkxmlid(body)
10977 then
10978 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
10979 ..body..
10980 "\" is not a valid xml:id. \\MessageBreak "
10981 ..
10982 "Please pick another id.}}")
10983 else
10984 end
10985 return string.format("<ptr target=\"#%s\"/>", body)
10986 end)
10987 return str
10988 end
10989
10990 local function cmdtotei(str)
10991 for i = 1,#cmdtotags
10992 do
10993 str = gsub(str, lpeg.P("\\") * lpeg.Cs(cmdtotags[i].a) * spcenc^-1 * bsqbrackets * -bcbraces, "\\%1%2{}")
10994 str = gsub(str, lpeg.P("\\") * lpeg.Cs(cmdtotags[i].a) * spcenc^-1 * -(bsqbrackets + bcbraces), "\\%1[]{}")
10995 str = string.gsub(str, "(\\"..cmdtotags[i].a..")%s?%*?(%b{})", "%1[]%2")
10996 str = string.gsub(str, "(\\"..cmdtotags[i].a..")%s?%*?(%b[])(%b{})",
10997 function(cmd, arg, body)
10998 body = string.sub(body, 2, -2)
10999 arg = string.sub(arg, 2, -2)
11000 arg = string.gsub(arg, "(%b{})", function(braces)
11001 braces = string.sub(braces, 2, -2)
11002 return string.format("\"%s\"", braces)
11003 end)
11004 body = cmdtotei(body)
11005 -- return string.format("<"..cmdtotags[i].b..cmdtotags[i].c.." %s>%s</"..cmdtotags[i].b..">", arg, body)
11006 if cmdtotags[i].b ~= ""
11007 then
11008 return string.format("<"..cmdtotags[i].b..cmdtotags[i].c..">%s</" ..
11009 cmdtotags[i].b..">", body)
11010 else
11011 return ""
11012 end
11013 end)
11014 end
11015 -- temporarily:
11016 str = string.gsub(str, "\\(getsiglum)%s?(%b{})",
11017 function(cmd, body)
11018 body = string.sub(body, 2, -2)
11019 teisiglum = ekdosis.getsiglum(body, "tei")
11020 printsiglum = ekdosis.getsiglum(body)
11021 -- body = cmdtotei(body)
11022 return string.format("<ref target=\"%s\">%s</ref>",
11023 teisiglum, printsiglum)
11024 end)
11025 str = string.gsub(str, "\\(gap)%s?(%b{})",
11026 function(cmd, body)
11027 body = string.sub(body, 2, -2)
11028 teireason = get_attr_value(body, "reason")
11029 if teireason ~= "" then teireason = " reason=\""..teireason.."\"" else end
11030 teiunit = get_attr_value(body, "unit")
11031 if teiunit ~= "" then teiunit = " unit=\""..teiunit.."\"" else end
11032 teiquantity = get_attr_value(body, "quantity")
11033 if teiquantity ~= "" then teiquantity = " quantity=\""..teiquantity.."\"" else end
11034 teiextent = get_attr_value(body, "extent")
11035 if teiextent ~= "" then teiextent = " extent=\""..teiextent.."\"" else end
11036 return string.format("<gap%s%s%s%s/>", teireason, teiunit, teiquantity, teiextent)
11037 end)
11038 str = gsub(str, lpeg.P("\\") * labelrefcmds * spcenc^-1 * bcbraces,
11039 function(cmd, body)
11040 body = string.sub(body, 2, -2)
11041 if not checkxmlid(body)
11042 then
11043 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
11044 ..body..
11045 "\" is not a valid xml:id. \\MessageBreak "
11046 ..
11047 "Please pick another id.}}")
11048 else
11049 end
11050 if string.find(cmd, "label")
11051 then
11052 return string.format("<anchor xml:id=\"%s\"/>", body)
11053 else
11054 return string.format("<ptr target=\"#%s\"/>", body)
11055 end
11056 end)
11057 str = string.gsub(str, "\\(%a+)%s?%*?(%b[])(%b{})",
11058 function(cmd, opt, body)
11059 body = string.sub(body, 2, -2)
11060 body = cmdtotei(body)
11061 return string.format("<%s>%s</%s>", cmd, body, cmd)
11062 end)
11063 str = string.gsub(str, "\\(%a+)%s?%*?(%b{})",
11064 function(cmd, body)
11065 body = string.sub(body, 2, -2)
11066 body = cmdtotei(body)
11067 return string.format("<%s>%s</%s>", cmd, body, cmd)
11068 end)
11069 str = string.gsub(str, "(%s)(%>)", "%2")
11070 return str
11071 end
11072
11073 local teiautopar = true
11074
11075 function ekdosis.setteiautopar(choice)
11076 if choice == "yes"
11077 then
11078 teiautopar = true
11079 else
11080 teiautopar = false
11081 end
11082 return true
11083 end
11084
11085 local function partotei(str)
11086 if teiautopar
11087 then
11088 str = gsub(str, lpeg.P(lpeg.P("\\par") * spcenc^1)^1, "\\par ")
11089 str = gsub(str, ((para + parb) * par^-1)^2, "\\p@r ")
11090 str = string.gsub(str, "\\p@ra%s+", "<p>")
11091 str = string.gsub(str, "\\p@rb%s+", "</p>")
11092 str = string.gsub(str, "\\p@r%s+", "")
11093 str = string.gsub(str, "%s?\\par%s?", "<p>", 1)
11094 str = string.gsub(str, "(%<p%>)(%s-)(%<%/?div%d?)", "%3")
11095 str = string.gsub(str, "%s?\\par%s?", "</p><p>")
11096 str = string.gsub(str, "<p>%s?</p>", "")
11097 str = string.gsub(str, "(%<p%>)%s?(%</div%>)$", "%2")
11098 str = string.gsub(str, "(%<p%>)%s?$", "")
11099 str = string.gsub(str, "(<p>)%s?(<div.->)", "%2%1")
11100 else
11101 str = gsub(str, par + para + parb, "")
11102 end
11103 return str
11104 end
11105
11106 local function self_close_tags(str)
11107 str = gsub(str, lpeg.P("<" * -lpeg.S("/"))
11108 * lpeg.Cs(letters^1)
11109 * lpeg.Cs((1 - lpeg.S"<>")^0)
11110 * lpeg.P(">")
11111 * lpeg.P("</")
11112 * lpeg.Cs(letters^1)
11113 * lpeg.P(">"), function(ftag, arg, ltag)
11114 if ftag == ltag
11115 then
11116 return string.format("<%s%s/>", ftag, arg)
11117 else
11118 end
11119 end)
11120 return str
11121 end
11122
11123 --headers and footers
11124 local hfmarks = {}
11125
11126 function ekdosis.storehfmark(page, mk, opt)
11127 if opt == "endmk"
11128 then
11129 local emark = hfmarks[#hfmarks].mark
11130 table.insert(hfmarks, {a = page, mark = emark})
11131 else
11132 table.insert(hfmarks, {a = page, mark = mk})
11133 end
11134 return true
11135 end
11136
11137 local printhfmarks = {
11138 HEL = true,
11139 HEC = true,
11140 HER = true,
11141 HOL = true,
11142 HOC = true,
11143 HOR = true,
11144 FOL = true,
11145 FOC = true,
11146 FOR = true,
11147 FEL = true,
11148 FEC = true,
11149 FER = true,
11150 }
11151
11152 function ekdosis.nohfmark()
11153 printhfmarks.HEL = false
11154 printhfmarks.HEC = false
11155 printhfmarks.HER = false
11156 printhfmarks.HOL = false
11157 printhfmarks.HOC = false
11158 printhfmarks.HOR = false
11159 printhfmarks.FOL = false
11160 printhfmarks.FOC = false
11161 printhfmarks.FOR = false
11162 printhfmarks.FEL = false
11163 printhfmarks.FEC = false
11164 printhfmarks.FER = false
11165 end
11166
11167 function ekdosis.resethfmark()
11168 printhfmarks.HEL = true
11169 printhfmarks.HEC = true
11170 printhfmarks.HER = true
11171 printhfmarks.HOL = true
11172 printhfmarks.HOC = true
11173 printhfmarks.HOR = true
11174 printhfmarks.FOL = true
11175 printhfmarks.FOC = true
11176 printhfmarks.FOR = true
11177 printhfmarks.FEL = true
11178 printhfmarks.FEC = true
11179 printhfmarks.FER = true
11180 end
11181
11182 function ekdosis.printmark(str, mk)
11183 if printhfmarks[mk]
11184 then
11185 return str
11186 else
11187 printhfmarks[mk] = true
11188 return ""
11189 end
11190 end
11191
11192 function ekdosis.gethfmark(page)
11193 local indexpage = get_a_index(page, hfmarks)
11194 if hfmarks[indexpage] ~= nil
11195 then
11196 return hfmarks[indexpage].mark
11197 else
11198 return hfmarks[#hfmarks-1].mark or ""
11199 end
11200 end
11201
11202 -- divisions of the body text
11203 local divdepth = {
11204 book = 1,
11205 part = 2,
11206 chapter = 3,
11207 section = 4,
11208 subsection = 5,
11209 subsubsection = 6
11210 }
11211
11212 function ekdosis.mkdivdepths(...)
11213 divdepth = {}
11214 local num = 1
11215 for _, y in ipairs{...}
11216 do
11217 if y == "book" or "part" or "chapter"
11218 or "section" or "subsection" or "subsubsection"
11219 then
11220 divdepth[y] = num
11221 num = num + 1
11222 else
11223 end
11224 end
11225 return true
11226 end
11227
11228 -- LaTeX side: format the divisions
11229 local fmtdiv = {}
11230
11231 function ekdosis.fmtdiv(n, fmtb, fmte)
11232 if isintable(fmtdiv, n)
11233 then
11234 local index = get_a_index(n, fmtdiv)
11235 table.remove(fmtdiv, index)
11236 else
11237 end
11238 table.insert(fmtdiv, { a = n, formatb = fmtb, formate = fmte} )
11239 return true
11240 end
11241
11242 function ekdosis.getfmtdiv(n, pos)
11243 local index = get_a_index(n, fmtdiv)
11244 if index ~= nil
11245 then
11246 if pos == "b"
11247 then
11248 return fmtdiv[index].formatb
11249 elseif pos == "e"
11250 then
11251 return fmtdiv[index].formate
11252 end
11253 else
11254 return ""
11255 end
11256 end
11257
11258 local ekddivs = true
11259
11260 function ekdosis.setekddivsfalse()
11261 ekddivs = false
11262 end
11263
11264 local function ekddivs_totei(str)
11265 str = gsub(str, dblbkslash * lpeg.Cs("ekddiv") * spce^-1 * bcbraces,
11266 function(bkslash, cmd, space, arg)
11267 if ekddivs
11268 then
11269 arg = string.sub(arg, 2, -2)
11270 teitype = get_attr_value(arg, "type")
11271 tein = get_attr_value(arg, "n")
11272 teihead = get_attr_value(arg, "head")
11273 teidepth = get_attr_value(arg, "depth")
11274 if teitype ~= "" then teitype = " type=\""..teitype.."\"" else end
11275 if tein ~= "" then tein = " n=\""..tein.."\"" else end
11276 if teidepth ~= ""
11277 then
11278 teidepth = " depth=\""..teidepth.."\""
11279 else
11280 teidepth = " depth=\"1\""
11281 end
11282 return string.format("\\p@rb <div%s%s%s><head>%s</head>\\p@ra ",
11283 teitype, tein, teidepth, teihead)
11284 else
11285 return ""
11286 end
11287 end)
11288 return str
11289 end
11290
11291 local function section_totei(str)
11292 str = gsub(str, dblbkslash * sections * spce^-1 * bcbraces, "%1%2%3[]%4")
11293 str = gsub(str, dblbkslash * sections * spce^-1 * bsqbrackets * bcbraces,
11294 function(bkslash, secname, space, opt, arg)
11295 if ekddivs
11296 then
11297 return ""
11298 else
11299 ctr = divdepth[secname]
11300 arg = string.sub(arg, 2, -2)
11301 return string.format("\\p@rb <div%s type=\"%s\"><head>%s</head>\\p@ra ",
11302 ctr, secname, arg)
11303 end
11304 end)
11305 return str
11306 end
11307
11308 local used_ndivs = {}
11309
11310 local function close_ekddivs_at_end(str)
11311 local isdiv = false
11312 if string.find(str, "</div>$")
11313 then
11314 isdiv = true
11315 str = string.gsub(str, "(.*)(</div>)$", "%1")
11316 else
11317 end
11318 -- collect used depth numbers
11319 for i in string.gmatch(str, "<div .-depth%=\"%d\".->")
11320 do
11321 i = string.match(i, "depth=\"%d\"")
11322 i = string.match(i, "%d")
11323 if isintable(used_ndivs, i)
11324 then
11325 else
11326 table.insert(used_ndivs, {a = i} )
11327 end
11328 end
11329 if next(used_ndivs) ~= nil
11330 then
11331 table.sort(used_ndivs, function(a ,b) return(#a.a > #b.a) end)
11332 else
11333 end
11334 local firstdiv = string.match(str, "<div .-depth%=\"%d\".->") or ""
11335 firstdiv = string.match(firstdiv, "depth%=\"%d\"") or ""
11336 firstdiv = string.match(firstdiv, "%d") or ""
11337 local lastdiv = string.match(string.reverse(str), ">.-\"%d\"%=htped.- vid<") or ""
11338 lastdiv = string.match(lastdiv, "\"%d\"%=htped") or ""
11339 lastdiv = string.match(lastdiv, "%d") or ""
11340 local firstdivindex = get_a_index(firstdiv, used_ndivs)
11341 local lastdivindex = get_a_index(lastdiv, used_ndivs)
11342 firstdivindex = tonumber(firstdivindex)
11343 lastdivindex = tonumber(lastdivindex)
11344 local closedivs = ""
11345 if isintable(used_ndivs, firstdiv)
11346 then
11347 while lastdivindex >= firstdivindex
11348 do
11349 closedivs = closedivs.."</div>"
11350 lastdivindex = lastdivindex - 1
11351 end
11352 end
11353 if isdiv
11354 then
11355 return str..closedivs.."</div>"
11356 else
11357 return str..closedivs
11358 end
11359 end
11360
11361 local function close_ndivs_at_end(str)
11362 local isdiv = false
11363 if string.find(str, "</div>$")
11364 then
11365 isdiv = true
11366 str = string.gsub(str, "(.*)(</div>)$", "%1")
11367 else
11368 end
11369 -- collect used div numbers
11370 for i in string.gmatch(str, "<div[1-6]")
11371 do
11372 i = string.match(i, "[1-6]")
11373 if isintable(used_ndivs, i)
11374 then
11375 else
11376 table.insert(used_ndivs, {a = i} )
11377 end
11378 end
11379 if next(used_ndivs) ~= nil
11380 then
11381 table.sort(used_ndivs, function(a ,b) return(#a.a > #b.a) end)
11382 else
11383 end
11384 local firstdiv = string.match(str, "<div[1-6]") or ""
11385 firstdiv = string.match(firstdiv, "[1-6]") or ""
11386 local lastdiv = string.match(string.reverse(str), "[1-6]vid<") or ""
11387 lastdiv = string.match(lastdiv, "[1-6]") or ""
11388 local firstdivindex = get_a_index(firstdiv, used_ndivs)
11389 local lastdivindex = get_a_index(lastdiv, used_ndivs)
11390 firstdivindex = tonumber(firstdivindex)
11391 lastdivindex = tonumber(lastdivindex)
11392 local closedivs = ""
11393 if isintable(used_ndivs, firstdiv)
11394 then
11395 while lastdivindex >= firstdivindex
11396 do
11397 closedivs = closedivs.."</div"..used_ndivs[lastdivindex].a..">"
11398 lastdivindex = lastdivindex - 1
11399 end
11400 end
11401 if isdiv
11402 then
11403 return str..closedivs.."</div>"
11404 else
11405 return str..closedivs
11406 end
11407 end
11408
11409 local function close_ekddivs_in_between(str)
11410 local maxdepth = 1
11411 for i in string.gmatch(str, "<div.-[Dd]epth=\"(%d)\".->", "%1")
11412 do
11413 if tonumber(i) > tonumber(maxdepth)
11414 then
11415 maxdepth = i
11416 else
11417 end
11418 end
11419 for ndivi = 1, maxdepth
11420 do
11421 str = string.gsub(str, "(<div [^%>]-[Dd]epth%=\")("..ndivi..")(\".->)(.-)(<div [^%>]-depth%=\")(%d)(\".->)",
11422 function(bdivi, ndivi, edivi, between, bdivii, ndivii, edivii)
11423 local firstdiv = ndivi
11424 local lastdiv = ndivii
11425 local firstdivindex = get_a_index(firstdiv, used_ndivs)
11426 local lastdivindex = get_a_index(lastdiv, used_ndivs)
11427 firstdivindex = tonumber(firstdivindex)
11428 lastdivindex = tonumber(lastdivindex)
11429 local closedivs = ""
11430 if firstdivindex >= lastdivindex
11431 then
11432 while firstdivindex >= lastdivindex
11433 do
11434 closedivs = closedivs.."</div>"
11435 firstdivindex = firstdivindex - 1
11436 bdivii = string.gsub(bdivii, "depth", "Depth")
11437 end
11438 end
11439 return string.format("%s%s%s%s%s%s%s%s",
11440 bdivi, ndivi, edivi, between,
11441 closedivs, bdivii, ndivii, edivii)
11442 end)
11443 end
11444 return str
11445 end
11446
11447 local function clean_ekddivs(str)
11448 str = string.gsub(str, "(<div.-)(%s[Dd]epth%=\"%d\")(.->)", "%1%3")
11449 used_ndivs = {}
11450 return str
11451 end
11452
11453 local function close_ndivs_in_between(str)
11454 for ndivi = 1, 6
11455 do
11456 str = string.gsub(str, "(<[Dd]iv)("..ndivi..")(.->)(.-)(<div)([1-6])(.->)",
11457 function(bdivi, ndivi, edivi, between, bdivii, ndivii, edivii)
11458 local firstdiv = ndivi
11459 local lastdiv = ndivii
11460 local firstdivindex = get_a_index(firstdiv, used_ndivs)
11461 local lastdivindex = get_a_index(lastdiv, used_ndivs)
11462 firstdivindex = tonumber(firstdivindex)
11463 lastdivindex = tonumber(lastdivindex)
11464 local closedivs = ""
11465 if firstdivindex >= lastdivindex
11466 then
11467 while firstdivindex >= lastdivindex
11468 do
11469 closedivs = closedivs.."</div"..used_ndivs[firstdivindex].a..">"
11470 firstdivindex = firstdivindex - 1
11471 bdivii = string.gsub(bdivii, "div", "Div")
11472 end
11473 end
11474 return string.format("%s%s%s%s%s%s%s%s",
11475 bdivi, ndivi, edivi, between,
11476 closedivs, bdivii, ndivii, edivii)
11477 end)
11478 end
11479 return str
11480 end
11481
11482 local function clean_latexdivs(str)
11483 str = string.gsub(str, "(<Div)([1-6])(.->)", "<div%2%3")
11484 used_ndivs = {}
11485 return str
11486 end
11487
11488 local function textotei(str)
11489 str = xml_entities(str)
11490 str = texpatttotei(str)
11491 str = note_totei(str)
11492 str = remove_extra_anchors(str)
11493 str = app_totei(str)
11494 str = rdgGrp_totei(str)
11495 str = lem_rdg_totei(str)
11496 str = relocate_notes(str)
11497 str = stanzatotei(str)
11498 str = versetotei(str)
11499 str = envtotei(str)
11500 str = ekddivs_totei(str)
11501 str = section_totei(str)
11502 str = icitetotei(str)
11503 str = cmdtotei(str)
11504 str = self_close_tags(str)
11505 str = partotei(str)
11506 if ekddivs
11507 then
11508 str = close_ekddivs_at_end(str)
11509 str = close_ekddivs_in_between(str)
11510 str = close_ekddivs_in_between(str)
11511 str = clean_ekddivs(str)
11512 else
11513 str = close_ndivs_at_end(str)
11514 str = close_ndivs_in_between(str)
11515 str = close_ndivs_in_between(str)
11516 str = clean_latexdivs(str)
11517 end
11518 return str
11519 end
11520
11521 local teifilename = tex.jobname.."-tei"
11522
11523 function ekdosis.setteifilename(str)
11524 teifilename = str
11525 return true
11526 end
11527
11528 function ekdosis.openteistream()
11529 local f = io.open(teifilename.."_tmp.xml", "a+")
11530 f:write('<?xml version="1.0" encoding="utf-8"?>', "\n")
11531 f:write("<TEI xmlns=\"http://www.tei-c.org/ns/1.0\">", "\n")
11532 f:write("<teiHeader>", "\n")
11533 f:write("<fileDesc>", "\n")
11534 f:write("<titleStmt>", "\n")
11535 f:write("<title><!-- Title --></title>", "\n")
11536 f:write("<respStmt>", "\n")
11537 f:write("<resp><!-- Edited by --></resp>", "\n")
11538 f:write("<name><!-- Name --></name>", "\n")
11539 f:write("</respStmt>", "\n")
11540 f:write("</titleStmt>", "\n")
11541 f:write("<publicationStmt>", "\n")
11542 f:write("<distributor><!-- Distributor name --></distributor>", "\n")
11543 f:write("</publicationStmt>", "\n")
11544 f:write("<sourceDesc>", "\n")
11545 if next(listWit) == nil and next(listPerson) == nil
11546 then
11547 f:write("<p>No source, born digital</p>", "\n")
11548 else
11549 if next(listWit) ~= nil
11550 then
11551 f:write("<listWit>", "\n")
11552 for i = 1,#listWit do
11553 f:write('<witness xml:id=\"', listWit[i].xmlid, "\">", "\n")
11554 f:write('<abbr type="siglum">', textotei(listWit[i].abbr), "</abbr>", "\n")
11555 f:write(textotei(listWit[i].detailsDesc), "\n")
11556 f:write("<msDesc>", "\n")
11557 if listWit[i].msIdentifier.settlement == ""
11558 and listWit[i].msIdentifier.institution == ""
11559 and listWit[i].msIdentifier.repository == ""
11560 and listWit[i].msIdentifier.collection == ""
11561 and listWit[i].msIdentifier.idno == ""
11562 and listWit[i].msIdentifier.msName == ""
11563 then
11564 f:write("<msIdentifier/>", "\n")
11565 else
11566 f:write("<msIdentifier>", "\n")
11567 if listWit[i].msIdentifier.settlement ~= "" then
11568 f:write("<settlement>", textotei(listWit[i].msIdentifier.settlement), "</settlement>", "\n")
11569 else end
11570 if listWit[i].msIdentifier.institution ~= "" then
11571 f:write("<institution>", textotei(listWit[i].msIdentifier.institution), "</institution>", "\n")
11572 else end
11573 if listWit[i].msIdentifier.repository ~= "" then
11574 f:write("<repository>", textotei(listWit[i].msIdentifier.repository), "</repository>", "\n")
11575 else end
11576 if listWit[i].msIdentifier.collection ~= "" then
11577 f:write("<collection>", textotei(listWit[i].msIdentifier.collection), "</collection>", "\n")
11578 else end
11579 if listWit[i].msIdentifier.idno ~= "" then
11580 f:write("<idno>", textotei(listWit[i].msIdentifier.idno), "</idno>", "\n")
11581 else end
11582 if listWit[i].msIdentifier.msName ~= "" then
11583 f:write("<msName>", textotei(listWit[i].msIdentifier.msName), "</msName>", "\n")
11584 else end
11585 f:write("</msIdentifier>", "\n")
11586 end
11587 if listWit[i].handDesc ~= nil then
11588 f:write("<physDesc>", "\n")
11589 f:write("<handDesc hands=\"", #listWit[i].handDesc, "\">", "\n")
11590 local j = 1
11591 while listWit[i].handDesc[j]
11592 do
11593 f:write("<handNote xml:id=\"", listWit[i].handDesc[j].xmlid, "\">", "\n")
11594 f:write('<abbr type="siglum">', textotei(listWit[i].handDesc[j].abbr), "</abbr>", "\n")
11595 f:write("<p>", textotei(listWit[i].handDesc[j].detailsDesc), "</p>", "\n")
11596 f:write("</handNote>", "\n")
11597 j = j + 1
11598 end
11599 f:write("</handDesc>", "\n")
11600 f:write("</physDesc>", "\n")
11601 else end
11602 if listWit[i].msContents ~= nil then
11603 f:write("<msContents>", "\n")
11604 f:write("<msItemStruct>", "\n")
11605 f:write("<locus>", textotei(listWit[i].msContents.msItemStruct.locus), "</locus>", "\n")
11606 f:write("</msItemStruct>", "\n")
11607 f:write("</msContents>", "\n")
11608 end
11609 if listWit[i].history ~= nil then
11610 f:write("<history>", "\n")
11611 f:write("<origin>", "\n")
11612 f:write("<origDate>", textotei(listWit[i].history.origin.origDate), "</origDate>", "\n")
11613 f:write("</origin>", "\n")
11614 f:write("</history>", "\n")
11615 end
11616 f:write("</msDesc>", "\n")
11617 f:write("</witness>", "\n")
11618 end
11619 f:write("</listWit>", "\n")
11620 end
11621 if next(listPerson) ~= nil
11622 then
11623 f:write("<listPerson xml:id=\"scholars\">", "\n")
11624 for i = 1,#listPerson do
11625 f:write('<person xml:id=\"', listPerson[i].xmlid, "\">", "\n")
11626 f:write('<persName>', "\n")
11627 f:write('<abbr type="siglum">', textotei(listPerson[i].abbr), "</abbr>", "\n")
11628 if listPerson[i].persName.name ~= nil
11629 then
11630 f:write(textotei(listPerson[i].persName.name))
11631 else
11632 if listPerson[i].persName.forename ~= ""
11633 then
11634 f:write("<forename>", textotei(listPerson[i].persName.forename), "</forename>", "\n")
11635 else
11636 f:write("<forename><!-- forename --></forename>", "\n")
11637 end
11638 if textotei(listPerson[i].persName.surname) ~= ""
11639 then
11640 f:write("<surname>", textotei(listPerson[i].persName.surname), "</surname>", "\n")
11641 else
11642 f:write("<surname><!-- surname --></surname>", "\n")
11643 end
11644 if textotei(listPerson[i].persName.addName) ~= ""
11645 then
11646 f:write("<addName>", textotei(listPerson[i].persName.addName), "</addName>", "\n")
11647 end
11648 end
11649 if listPerson[i].note ~= ""
11650 then
11651 f:write("<note>", textotei(listPerson[i].note), "</note>", "\n")
11652 end
11653 f:write('</persName>', "\n")
11654 f:write('</person>', "\n")
11655 end
11656 f:write("</listPerson>", "\n")
11657 end
11658 end
11659 f:write("</sourceDesc>", "\n")
11660 f:write("</fileDesc>", "\n")
11661 f:write("<encodingDesc>", "\n")
11662 f:write('<variantEncoding method="parallel-segmentation" location="internal"/>', "\n")
11663 f:write("</encodingDesc>", "\n")
11664 f:write("</teiHeader>", "\n")
11665 f:write("<text>", "\n")
11666 f:write("<body>", "\n")
11667 f:close()
11668 return true
11669 end
11670
11671 local tidy = nil
11672
11673 local function cleanup_tei()
11674 local f = assert(io.open(teifilename.."_tmp.xml", "r"))
11675 t = f:read("*a")
11676 t = string.gsub(t, "%<p%>%s?%</p%>", "")
11677 t = string.gsub(t, "^\n", "")
11678 f:close()
11679 local fw = assert(io.open(teifilename.."_tmp.xml", "w"))
11680 fw:write(t)
11681 fw:close()
11682 return true
11683 end
11684
11685 function ekdosis.closeteistream(opt)
11686 local f = io.open(teifilename.."_tmp.xml", "a+")
11687 f:write("\n", "</body>", "\n")
11688 if xmlbibresource ~= nil then
11689 bibf = assert(io.open(xmlbibresource, "r"))
11690 t = bibf:read("*a")
11691 t = string.gsub(t, "%s+corresp%=%b\"\"", "")
11692 t = string.gsub(t, "\n\n", "\n")
11693 f:write("<back>", "\n")
11694 f:write("<listBibl>", "\n")
11695 for i in string.gmatch(t, "<biblStruct.->.-</biblStruct>")
11696 do
11697 f:write(i, "\n")
11698 end
11699 f:write("</listBibl>", "\n")
11700 f:write("</back>", "\n")
11701 bibf:close()
11702 else
11703 end
11704 f:write("</text>", "\n")
11705 f:write("</TEI>", "\n")
11706 f:close()
11707 cleanup_tei()
11708 os.remove(teifilename..".xml")
11709 os.rename(teifilename.."_tmp.xml", teifilename..".xml")
11710 if opt == "tidy" then
11711 os.execute("tidy -qmi -xml --output-xml yes "..teifilename..".xml")
11712 else
11713 end
11714 return true
11715 end
11716
11717 function ekdosis.exporttei(str)
11718 local f = io.open(teifilename.."_tmp.xml", "a+")
11719 -- f:write("\n<p>")
11720 str = textotei(str)
11721 f:write(str)
11722 f:close()
11723 return true
11724 end
11725 -- end totei functions
11726
11727 -- begin basic TeX Conspectus siglorum
11728 function ekdosis.basic_cs(msid)
11729 local indexwit = getindex(msid, listWit)
11730 siglum = listWit[indexwit].abbr
11731 -- if listWit[indexwit].detailsDesc == ""
11732 -- then
11733 -- name = listWit[indexwit].msIdentifier.msName
11734 -- else
11735 -- name = listWit[indexwit].msIdentifier.msName
11736 -- .."\\thinspace\\newline\\bgroup\\footnotesize{}"..
11737 -- listWit[indexwit].detailsDesc
11738 -- .."\\egroup{}"
11739 -- end
11740 name = listWit[indexwit].detailsDesc
11741 if listWit[indexwit].history ~= nil
11742 and
11743 listWit[indexwit].history.origin ~= nil
11744 then
11745 date = listWit[indexwit].history.origin.origDate
11746 else
11747 date = ""
11748 end
11749 if listWit[indexwit].msContents ~= nil
11750 and
11751 listWit[indexwit].msContents.msItemStruct ~= nil
11752 then
11753 locus = listWit[indexwit].msContents.msItemStruct.locus
11754 else
11755 locus = ""
11756 end
11757 return siglum.."&"..name.." "..locus.."&"..date
11758 end
11759 -- end basic TeX Conspectus siglorum
11760
11761 function ekdosis.removesp(str)
11762 str = gsub(str, cmd * cmdargs * spcenc^-1, "%1%2")
11763 return str
11764 end
11765
11766 function ekdosis.closestream()
11767 os.remove(tex.jobname..".ekd")
11768 os.rename(tex.jobname.."_tmp.ekd", tex.jobname..".ekd")
11769 return true
11770 end
11771
11772 local cur_abs_pg = 0
11773 local ekd_abs_pg = 0
11774 local pg_i = nil
11775 local pg_ii = nil
11776 local prevcol = nil
11777 local curcol = "x"
11778
11779 local check_resetlineno = {}
11780
11781 function ekdosis.update_abspg(n) -- not used
11782 cur_abs_pg = n
11783 return true
11784 end
11785
11786 function ekdosis.storeabspg(n, pg)
11787 if tonumber(n) > tonumber(cur_abs_pg)
11788 then
11789 ekd_abs_pg = ekd_abs_pg + 1
11790 end
11791 cur_abs_pg = n
11792 n = ekd_abs_pg
11793 if pg == "pg_i" then
11794 pg_i = n
11795 elseif pg == "pg_ii" then
11796 pg_ii = n
11797 table.insert(check_resetlineno, curcol.."-"..pg_ii)
11798 end
11799 return true
11800 end
11801
11802 function ekdosis.getekdabspg()
11803 return ekd_abs_pg
11804 end
11805
11806 function ekdosis.checkresetlineno()
11807 if isfound(check_resetlineno, curcol.."-"..pg_i)
11808 then
11809 return ""
11810 else
11811 return "\\resetlinenumber"
11812 end
11813 end
11814
11815 --
11816 -- Build environments to be aligned
11817 --
11818
11819 local cur_alignment = "-"
11820 local cur_alignment_patt = "%-"
11821 local cur_alignment_cnt = 1
11822
11823 local newalignment = false
11824 function ekdosis.newalignment(str)
11825 if str == "set"
11826 then
11827 newalignment = true
11828 cur_alignment = "-"..cur_alignment_cnt.."-"
11829 cur_alignment_patt = "%-"..cur_alignment_cnt.."%-"
11830 cur_alignment_cnt = cur_alignment_cnt + 1
11831 elseif str == "reset"
11832 then
11833 newalignment = false
11834 cur_alignment = "-"
11835 cur_alignment_patt = "%-"
11836 end
11837 return true
11838 end
11839
11840 local aligned_texts = {}
11841 local texts_w_apparatus = {}
11842 local coldata_totei = {}
11843
11844 local function sanitize_envdata(str) -- look for a better way to achieve this
11845 str = string.gsub(str, "(%a+)%s+(%b[])", "%1%2")
11846 str = string.gsub(str, "(%a+)(%b[])%s+", "%1%2")
11847 str = string.gsub(str, "%s+(%a+)(%b[])", "%1%2")
11848 str = gsub(str, lpeg.Cs(letters^1)
11849 * spcenc^-1
11850 * -bsqbrackets
11851 * lpeg.Cs(";"), "%1[]%2")
11852 str = string.gsub(str, "%s+(%a+)(%b[])", "%1%2")
11853 return str
11854 end
11855
11856 function ekdosis.mkenvdata(str, opt)
11857 if not string.find(str, "%;", -1) then str = str .. ";" else end
11858 -- str = str ..";"
11859 -- str = string.gsub(str, "%s+", "")
11860 local fieldstart = 1
11861 local col = 0
11862 if opt == "texts" then
11863 str = sanitize_envdata(str)
11864 repeat
11865 local _s, nexti = string.find(str, "%b[]%s-%;", fieldstart)
11866 local namediv = string.gsub(string.sub(str, fieldstart, nexti-1), "(%a+)%s-(%b[])", "%1")
11867 local attr = string.gsub(string.sub(str, fieldstart, nexti-1), "(%a+)%s-(%b[])", "%2")
11868 attr = string.sub(attr, 2, -2)
11869 if forbid_xmlid
11870 then
11871 attr = string.gsub(attr, "xml:id", "n") -- xml:id is not allowed here
11872 else
11873 end
11874 table.insert(aligned_texts, { text = namediv,
11875 attribute = attr,
11876 column = col })
11877 table.insert(coldata_totei, { environment = namediv,
11878 data = {} })
11879 col = col + 1
11880 fieldstart = nexti + 1
11881 until fieldstart > string.len(str)
11882 return aligned_texts
11883 elseif opt == "apparatus" then
11884 repeat
11885 local nexti = string.find(str, "%;", fieldstart)
11886 table.insert(texts_w_apparatus, string.sub(str, fieldstart, nexti-1))
11887 fieldstart = nexti +1
11888 until fieldstart > string.len(str)
11889 return texts_w_apparatus
11890 end
11891 end
11892
11893 -- Reminder: the following two variables are already set above
11894 -- local prevcol = nil
11895 -- local curcol = "x"
11896
11897 function ekdosis.storecurcol(n)
11898 curcol = n
11899 return true
11900 end
11901
11902 function ekdosis.flushcolnums()
11903 prevcol = nil
11904 curcol = "x"
11905 return true
11906 end
11907
11908 function ekdosis.flushenvdata()
11909 aligned_texts = {}
11910 texts_w_apparatus = {}
11911 coldata_totei = {}
11912 return true
11913 end
11914
11915 function ekdosis.storecoldata(nthcol, chunk)
11916 local tindex = tonumber(nthcol) + 1
11917 table.insert(coldata_totei[tindex].data, chunk)
11918 return true
11919 end
11920
11921 local environment_div = {}
11922
11923 local function build_envdiv(str)
11924 if not environment_div[str]
11925 then
11926 environment_div[str] = 1
11927 else
11928 environment_div[str] = environment_div[str] + 1
11929 end
11930 local div = "div-"..str.."_"..environment_div[str]
11931 if xmlidfound(div)
11932 then
11933 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
11934 ..div..
11935 "\" already exists as an xml:id. "
11936 ..
11937 "ekdosis has generated some random id.}}")
11938 return "div-"..math.random(1000,9999)
11939 elseif not checkxmlid(div)
11940 then
11941 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
11942 ..div..
11943 "\" is not a valid xml:id. \\MessageBreak "
11944 ..
11945 "Please pick another id.}}")
11946 else
11947 table.insert(xmlids, {xmlid = div})
11948 table.sort(xmlids, function(a ,b) return(#a.xmlid > #b.xmlid) end)
11949 return div
11950 end
11951 end
11952
11953 function ekdosis.mkenv()
11954 local environments = {}
11955 for i = 1,#aligned_texts
11956 do
11957 if isfound(texts_w_apparatus, aligned_texts[i].text)
11958 then
11959 table.insert(environments, "\\NewDocumentEnvironment{".. aligned_texts[i].text.."}{+b}"
11960 .."{\\begin{nthcolumn}{".. aligned_texts[i].column.."}"
11961 .."\\par"
11962 .."\\EkdosisColStart"
11963 .."\\EkdosisOn#1"
11964 .."}{\\EkdosisOff"
11965 .."\\EkdosisColStop"
11966 .."\\end{nthcolumn}"
11967 .."\\csname iftei@export\\endcsname\\luadirect{ekdosis.storecoldata("
11968 .. aligned_texts[i].column
11969 ..", \\luastringN{\\par#1\\par})}\\fi"
11970 .."}")
11971 table.insert(environments, "\\NewDocumentEnvironment{".. aligned_texts[i].text.."*}{+b}"
11972 .."{\\begin{nthcolumn*}{".. aligned_texts[i].column.."}[]"
11973 .."\\par"
11974 .."\\EkdosisColStart"
11975 .."\\EkdosisOn#1"
11976 .."}{\\EkdosisOff"
11977 .."\\EkdosisColStop"
11978 .."\\end{nthcolumn*}"
11979 .."\\csname iftei@export\\endcsname\\luadirect{ekdosis.storecoldata("
11980 .. aligned_texts[i].column
11981 ..", \\luastringN{\\par#1\\par})}\\fi"
11982 .."}")
11983 else
11984 table.insert(environments, "\\NewDocumentEnvironment{".. aligned_texts[i].text.."}{+b}"
11985 .."{\\begin{nthcolumn}{".. aligned_texts[i].column.."}"
11986 .."\\par"
11987 .."#1"
11988 .."}{\\end{nthcolumn}"
11989 .."\\csname iftei@export\\endcsname\\luadirect{ekdosis.storecoldata("
11990 .. aligned_texts[i].column
11991 ..", \\luastringN{\\par#1\\par})}\\fi"
11992 .."}")
11993 table.insert(environments, "\\NewDocumentEnvironment{".. aligned_texts[i].text.."*}{+b}"
11994 .."{\\begin{nthcolumn*}{"..aligned_texts[i].column.."}[]"
11995 .."\\par"
11996 .."#1"
11997 .."}{"
11998 .."\\end{nthcolumn*}"
11999 .."\\csname iftei@export\\endcsname\\luadirect{ekdosis.storecoldata("
12000 .. aligned_texts[i].column
12001 ..", \\luastringN{\\par#1\\par})}\\fi"
12002 .."}")
12003 end
12004 forbid_xmlid = false
12005 if aligned_texts[i].attribute ~= ""
12006 then
12007 ekdosis.newenvtotag(aligned_texts[i].text, "div",
12008 "xml:id=\""
12009 ..build_envdiv(aligned_texts[i].text)
12010 .."\" "
12011 ..aligned_texts[i].attribute)
12012 else
12013 ekdosis.newenvtotag(aligned_texts[i].text, "div",
12014 "xml:id=\""
12015 ..build_envdiv(aligned_texts[i].text)
12016 .."\"")
12017 end
12018 forbid_xmlid = true
12019 end
12020 str = table.concat(environments)
12021 return str
12022 end
12023
12024 function ekdosis.export_coldata_totei()
12025 for i = 1,#coldata_totei
12026 do
12027 ekdosis.exporttei("\\begin{".. coldata_totei[i].environment .."}"
12028 .. table.concat(coldata_totei[i].data)
12029 .. "\\end{".. coldata_totei[i].environment .."}")
12030 end
12031 end
12032
12033 -- handle multiple layers in apparatuses
12034 --
12035 local apparatuses = {}
12036 local bagunits = {}
12037
12038 function ekdosis.newapparatus(teitype,
12039 appdir,
12040 apprule,
12041 appdelim,
12042 appsep,
12043 appsubsep,
12044 appbhook,
12045 appehook,
12046 applimit,
12047 applang,
12048 appnotelang)
12049 if isintable(apparatuses, teitype)
12050 then
12051 tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\""
12052 ..teitype..
12053 "\" already exists.}}")
12054 else
12055 table.insert(apparatuses, {a = teitype,
12056 direction = appdir,
12057 rule = apprule,
12058 delim = appdelim,
12059 sep = appsep,
12060 subsep = appsubsep,
12061 bhook = appbhook,
12062 ehook = appehook,
12063 limit = applimit,
12064 lang = applang,
12065 notelang = appnotelang})
12066 end
12067 bagunits[teitype] = 1
12068 return true
12069 end
12070
12071 function ekdosis.getapplang(teitype)
12072 i = get_a_index(teitype, apparatuses)
12073 if apparatuses[i].lang ~= ""
12074 then
12075 return apparatuses[i].lang
12076 else
12077 return "\\languagename"
12078 end
12079 end
12080
12081 function ekdosis.getappnotelang(teitype)
12082 i = get_a_index(teitype, apparatuses)
12083 if apparatuses[i].notelang ~= ""
12084 then
12085 return apparatuses[i].notelang
12086 else
12087 return "\\languagename"
12088 end
12089 end
12090
12091 function ekdosis.getappdelim(str)
12092 for i = 1,#apparatuses
12093 do
12094 if apparatuses[i].a == str then
12095 delimfound = apparatuses[i].delim
12096 break
12097 end
12098 end
12099 return delimfound
12100 end
12101
12102 function ekdosis.get_bagunits(teitype)
12103 return bagunits[teitype]
12104 end
12105
12106 local function getapplimit(teitype)
12107 for i = 1,#apparatuses
12108 do
12109 if apparatuses[i].a == teitype then
12110 limitfound = apparatuses[i].limit
12111 break
12112 end
12113 end
12114 if tonumber(limitfound) ~= nil
12115 then
12116 if tonumber(limitfound) < 10
12117 then
12118 return 0
12119 else
12120 return limitfound
12121 end
12122 else
12123 return 0
12124 end
12125 end
12126
12127 function ekdosis.limit_bagunits(teitype)
12128 local limit = tonumber(getapplimit(teitype))
12129 if limit >= 10 and bagunits[teitype] >= limit
12130 then
12131 bagunits[teitype] = 2
12132 return "\\pagebreak"
12133 else
12134 return ""
12135 end
12136 end
12137
12138 function ekdosis.addto_bagunits(teitype, n)
12139 if tonumber(getapplimit(teitype)) ~= 0
12140 then
12141 n = tonumber(n)
12142 bagunits[teitype] = bagunits[teitype] - n
12143 end
12144 end
12145
12146 function ekdosis.increment_bagunits(teitype)
12147 bagunits[teitype] = (bagunits[teitype] or 0) + 1
12148 end
12149
12150 local function reset_bagunits()
12151 for i = 1,#apparatuses
12152 do
12153 bagunits[apparatuses[i].a] = 1
12154 end
12155 end
12156
12157 function ekdosis.appin(str, teitype)
12158 local f = io.open(tex.jobname.."_tmp.ekd", "a+")
12159 if next(apparatuses) == nil
12160 then
12161 f:write("<", ekd_abs_pg, cur_alignment, curcol, "-0>", str, "</",
12162 ekd_abs_pg, cur_alignment, curcol, "-0>\n")
12163 else
12164 for i = 1,#apparatuses
12165 do
12166 if apparatuses[i].a == teitype then
12167 appno = i
12168 break
12169 end
12170 end
12171 f:write("<", ekd_abs_pg, cur_alignment, curcol, "-",
12172 appno, ">", str, "</", ekd_abs_pg, cur_alignment, curcol, "-", appno, ">\n")
12173 end
12174 f:close()
12175 return true
12176 end
12177
12178 function ekdosis.appout()
12179 local file = io.open(tex.jobname..".ekd", "r")
12180 if file ~= nil then io.close(file)
12181 f = assert(io.open(tex.jobname..".ekd", "r"))
12182 t = f:read("*a")
12183 local output = {}
12184 if next(apparatuses) == nil then
12185 -- table.insert(output, "BEGIN")
12186 table.insert(output, "\\csname ekd@default@rule\\endcsname\\NLS")
12187 table.insert(output, "\\csname ekd@begin@apparatus\\endcsname\\ignorespaces")
12188 -- table.insert(output, "\\noindent ")
12189 for i in string.gmatch(t,
12190 "<"..ekd_abs_pg
12191 ..cur_alignment_patt
12192 ..curcol.."%-0>.-</"
12193 ..ekd_abs_pg
12194 ..cur_alignment_patt
12195 ..curcol.."%-0>")
12196 do
12197 table.insert(output, i)
12198 end
12199 -- table.insert(output, "END")
12200 else
12201 local appinserted = false
12202 local n = 1
12203 while apparatuses[n]
12204 do
12205 if string.match(t, "<"..ekd_abs_pg
12206 ..cur_alignment_patt
12207 ..curcol.."%-"..n..">.-</"
12208 ..ekd_abs_pg
12209 ..cur_alignment_patt
12210 ..curcol.."%-"..n..">")
12211 then
12212 -- table.insert(output, "BEGIN")
12213 table.insert(output, "\\bgroup{}")
12214 if apparatuses[n].direction == "LR"
12215 then
12216 table.insert(output, "\\pardir TLT\\leavevmode\\textdir TLT{}")
12217 elseif apparatuses[n].direction == "RL"
12218 then
12219 table.insert(output, "\\pardir TRT\\leavevmode\\textdir TRT{}")
12220 end
12221 if apparatuses[n].rule == "none"
12222 then
12223 if n > 1
12224 then
12225 if appinserted
12226 then
12227 table.insert(output, "\\NLS{}")
12228 end
12229 else
12230 table.insert(output, "\\noindent ")
12231 end
12232 elseif apparatuses[n].rule ~= ""
12233 then
12234 if n > 1
12235 then
12236 if appinserted
12237 then
12238 table.insert(output, "\\NLS{}" .. apparatuses[n].rule .. "\\NLS{}")
12239 else
12240 table.insert(output, apparatuses[n].rule .. "\\NLS{}")
12241 end
12242 else
12243 -- table.insert(output, "\\noindent ")
12244 table.insert(output, apparatuses[n].rule .. "\\NLS{}")
12245 end
12246 else
12247 if n > 1
12248 then
12249 if appinserted
12250 then
12251 table.insert(output, "\\NLS\\csname ekd@default@rule\\endcsname\\NLS{}")
12252 else
12253 table.insert(output, "\\csname ekd@default@rule\\endcsname\\NLS{}")
12254 end
12255 else
12256 -- table.insert(output, "\\noindent ")
12257 table.insert(output, "\\csname ekd@default@rule\\endcsname\\NLS{}")
12258 end
12259 end
12260 if apparatuses[n].sep ~= ""
12261 then
12262 table.insert(output, "\\edef\\ekdsep{" .. apparatuses[n].sep .. "}")
12263 else
12264 end
12265 if apparatuses[n].subsep ~= ""
12266 then
12267 table.insert(output, "\\edef\\ekdsubsep{" .. apparatuses[n].subsep .. "}")
12268 end
12269 if apparatuses[n].bhook ~= ""
12270 then
12271 table.insert(output, apparatuses[n].bhook)
12272 else
12273 table.insert(output, "\\relax")
12274 end
12275 for i in string.gmatch(t,
12276 "<"..ekd_abs_pg
12277 ..cur_alignment_patt
12278 ..curcol.."%-"..n..">.-</"
12279 ..ekd_abs_pg
12280 ..cur_alignment_patt
12281 ..curcol.."%-"..n..">")
12282 do
12283 table.insert(output, i)
12284 appinserted = true
12285 end
12286 if apparatuses[n].ehook ~= ""
12287 then
12288 table.insert(output, apparatuses[n].ehook)
12289 else
12290 end
12291 table.insert(output, "\\egroup{}")
12292 -- table.insert(output, "END")
12293 end
12294 n = n + 1
12295 end
12296 end
12297 f:close()
12298 str = table.concat(output)
12299 str = string.gsub(str, "</"..ekd_abs_pg..cur_alignment_patt..curcol.."%-[0-9]>", "")
12300 str = string.gsub(str, "<"..ekd_abs_pg..cur_alignment_patt..curcol.."%-[0-9]>", " ")
12301 return str
12302 else
12303 end
12304 end
12305
12306 function ekdosis.appin_out(str, nl)
12307 local f = io.open(tex.jobname.."_tmp.ekd", "a+")
12308 if nl == "yes" then
12309 f:write(str, "\n")
12310 else
12311 f:write(str)
12312 end
12313 f:close()
12314 return true
12315 end
12316
12317 local curcol_curabspg = {}
12318
12319 function ekdosis.testapparatus()
12320 if isfound(curcol_curabspg, curcol.."-"..ekd_abs_pg)
12321 then
12322 if newalignment
12323 then
12324 if next(apparatuses) ~= nil then
12325 reset_bagunits()
12326 end
12327 newalignment = false
12328 return "\\booltrue{do@app}"
12329 else
12330 return "\\boolfalse{do@app}"
12331 end
12332 else
12333 table.insert(curcol_curabspg, curcol.."-"..ekd_abs_pg)
12334 if next(apparatuses) ~= nil then
12335 reset_bagunits()
12336 end
12337 newalignment = false
12338 return "\\booltrue{do@app}"
12339 end
12340 end
12341
12342 local function get_ln_prefix(x, y)
12343 for index = 1, string.len(x)
12344 do
12345 if string.sub(x, index, index) ~= string.sub(y, index, index)
12346 then
12347 return string.sub(x, 1, index - 1)
12348 end
12349 end
12350 end
12351
12352 function ekdosis.numrange(x, y)
12353 xstr = tostring(x)
12354 ystr = tostring(y)
12355 if x == y -- which will never apply
12356 then
12357 return "\\LRnum{" .. xstr .. "}"
12358 elseif string.len(xstr) ~= string.len(ystr)
12359 then
12360 return "\\LRnum{" .. xstr .. "}--\\LRnum{" .. ystr .. "}"
12361 else
12362 common = get_ln_prefix(xstr, ystr)
12363 if string.len(common) == 0
12364 then
12365 return "\\LRnum{" .. xstr .. "}--\\LRnum{" .. ystr .. "}"
12366 elseif string.sub(xstr, -2, -2) == "1"
12367 then
12368 return "\\LRnum{"
12369 .. string.sub(common, 1, -2)
12370 .. string.sub(xstr, string.len(common), -1)
12371 .. "}--\\LRnum{"
12372 .. string.sub(ystr, string.len(common), -1)
12373 .. "}"
12374 else
12375 return "\\LRnum{"
12376 .. string.sub(common, 1, -1)
12377 .. string.sub(xstr, string.len(common) + 1, -1)
12378 .. "}--\\LRnum{"
12379 .. string.sub(ystr, string.len(common) + 1, -1)
12380 .. "}"
12381 end
12382 end
12383 end
12384
12385 local lnlabs = {}
12386 local lnlab_salt = 0
12387 local current_lnlab = nil
12388 local prev_lnlab = nil
12389 local prev_prev_lnlab = nil
12390 local notelabs = {}
12391 local current_notelab = nil
12392 local prev_notelab = nil
12393 local current_lemma = nil
12394 local salt = 0
12395
12396 local function mdvisintable(table, value)
12397 for _, v in pairs(table) do
12398 if v == value then return true end
12399 end
12400 return false
12401 end
12402
12403 function ekdosis.dolnlab(str)
12404 if prev_lnlab ~= nil then prev_prev_lnlab = prev_lnlab end
12405 prev_lnlab = current_lnlab
12406 current_lemma = str
12407 i = md5.sumhexa(str)
12408 if not mdvisintable(lnlabs, i) then
12409 table.insert(lnlabs, i)
12410 else
12411 i = i..salt
12412 table.insert(lnlabs, i)
12413 salt = salt + 1
12414 end
12415 current_lnlab = i
12416 return true
12417 end
12418
12419 function ekdosis.getlnlab()
12420 return current_lnlab
12421 end
12422
12423 function ekdosis.getprevlnlab()
12424 return prev_lnlab
12425 end
12426
12427 function ekdosis.getprevprevlnlab()
12428 return prev_prev_lnlab
12429 end
12430
12431 function ekdosis.setnotelab(str)
12432 current_notelab = str
12433 if isfound(notelabs, current_notelab)
12434 then
12435 return ""
12436 else
12437 table.insert(notelabs, current_notelab)
12438 return "\\linelabel{" .. current_notelab .. "}"
12439 end
12440 end
12441
12442 function ekdosis.getnotelab()
12443 return current_notelab
12444 end
12445
12446 function ekdosis.setprevnotelab(str)
12447 prev_notelab = str
12448 return true
12449 end
12450
12451 function ekdosis.getprevnotelab()
12452 return prev_notelab
12453 end
12454
12455 local cmdstorm = lpeg.P(lpeg.P("note")
12456 + lpeg.P("linelabel")
12457 + lpeg.P("index"))
12458
12459 local function remove_from_app(str)
12460 str = gsub(str, dblbkslash * cmdstorm * cmdargs, "")
12461 return str
12462 end
12463
12464 function ekdosis.mdvappend(str, teitype)
12465 if teitype == nil
12466 then
12467 return "\\linelabel{" .. current_lnlab .. "-b}\\wordboundary{}"
12468 ..
12469 current_lemma
12470 ..
12471 "\\linelabel{" .. current_lnlab .. "-e}"
12472 ..
12473 "\\csname append@app\\endcsname{"
12474 .. remove_from_app(str) .. "}"
12475 else
12476 return "\\linelabel{" .. current_lnlab .. "-b}\\wordboundary{}"
12477 ..
12478 current_lemma
12479 ..
12480 "\\linelabel{" .. current_lnlab .. "-e}"
12481 ..
12482 "\\csname append@app\\endcsname" .. "[" .. teitype .. "]{"
12483 .. remove_from_app(str) .. "}"
12484 end
12485 end
12486
12487 % \end{ekdlua}
12488 % \end{comment}
12489 % \iffalse
12490 %</lua>
12491 % \fi
12492 %
12493 \endinput