diff options
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | ekdosis.dtx | 1233 |
2 files changed, 1171 insertions, 66 deletions
@@ -17,9 +17,9 @@ sty: clean | |||
17 | $(CMP) $(NAME).ins >/dev/null | 17 | $(CMP) $(NAME).ins >/dev/null |
18 | 18 | ||
19 | $(NAME).pdf: $(NAME).dtx | 19 | $(NAME).pdf: $(NAME).dtx |
20 | @ echo "Make the sample files first..." | 20 | @ echo "Making the sample files first..." |
21 | $(MAKE) --directory=$(SAMPLES) | 21 | $(MAKE) --directory=$(SAMPLES) |
22 | @ echo "Build the documentation of $(NAME)..." | 22 | @ echo "Building the documentation of $(NAME)..." |
23 | $(CMP) --shell-escape --recorder --interaction=batchmode $(NAME).dtx >/dev/null | 23 | $(CMP) --shell-escape --recorder --interaction=batchmode $(NAME).dtx >/dev/null |
24 | biber $(NAME) >/dev/null | 24 | biber $(NAME) >/dev/null |
25 | $(CMP) --shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null | 25 | $(CMP) --shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null |
diff --git a/ekdosis.dtx b/ekdosis.dtx index bd829b0..66aab79 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx | |||
@@ -64,6 +64,30 @@ along with this program. If not, see | |||
64 | [2020/07/08 v0.99a Typesetting TEI xml compliant critical editions] | 64 | [2020/07/08 v0.99a Typesetting TEI xml compliant critical editions] |
65 | %</package> | 65 | %</package> |
66 | %<*driver> | 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 | </listBibl> | ||
90 | \end{filecontents} | ||
67 | \begin{filecontents}[overwrite]{\jobname.bib} | 91 | \begin{filecontents}[overwrite]{\jobname.bib} |
68 | @Article{Alessi2020, | 92 | @Article{Alessi2020, |
69 | author = {Alessi, Robert}, | 93 | author = {Alessi, Robert}, |
@@ -104,6 +128,17 @@ along with this program. If not, see | |||
104 | publisher = {Harper \& Brothers}, | 128 | publisher = {Harper \& Brothers}, |
105 | location = {New York}} | 129 | location = {New York}} |
106 | 130 | ||
131 | @Book{ReynoldsWilson1991, | ||
132 | author = {Reynolds, L. D. and Wilson, N. G}, | ||
133 | title = {Scribes and Scholars}, | ||
134 | year = {1991}, | ||
135 | subtitle = {A Guide to the Translation of Greek and Latin | ||
136 | Literature}, | ||
137 | edition = {3}, | ||
138 | publisher = {Clarendon Press}, | ||
139 | location = {Oxford} | ||
140 | } | ||
141 | |||
107 | @Online{DLL-TC, | 142 | @Online{DLL-TC, |
108 | author = {{Digital Latin Library}}, | 143 | author = {{Digital Latin Library}}, |
109 | title = {Textual Criticism}, | 144 | title = {Textual Criticism}, |
@@ -166,6 +201,15 @@ along with this program. If not, see | |||
166 | version = {1.20} | 201 | version = {1.20} |
167 | } | 202 | } |
168 | 203 | ||
204 | @Software{icite, | ||
205 | title = {The Icite package}, | ||
206 | subtitle = {Indices locorum citatorum}, | ||
207 | author = {Alessi, Robert}, | ||
208 | url = {http://ctan.org/pkg/icite}, | ||
209 | date = {2020-03-05}, | ||
210 | version = {1.3a} | ||
211 | } | ||
212 | |||
169 | @Software{arabtex, | 213 | @Software{arabtex, |
170 | title = {The Arabtex package}, | 214 | title = {The Arabtex package}, |
171 | titleaddon = {Macros and fonts for typesetting Arabic}, | 215 | titleaddon = {Macros and fonts for typesetting Arabic}, |
@@ -238,6 +282,16 @@ along with this program. If not, see | |||
238 | \DeclareWitness{hI}{I}{\emph{Parisinus Gr.} 2140} | 282 | \DeclareWitness{hI}{I}{\emph{Parisinus Gr.} 2140} |
239 | \DeclareWitness{hR}{R}{\emph{Vaticanus Gr.} 277} | 283 | \DeclareWitness{hR}{R}{\emph{Vaticanus Gr.} 277} |
240 | \DeclareWitness{hH}{H}{\emph{Parisinus Gr.} 2142} | 284 | \DeclareWitness{hH}{H}{\emph{Parisinus Gr.} 2142} |
285 | % Silius Italicus' Punica, IX, 30--2: | ||
286 | \DeclareWitness{sL}{L}{Laurentianus, plut, XXXVII, cod. 16}[ | ||
287 | origDate=s. XV] | ||
288 | \DeclareWitness{sF}{F}{Florentianus, Bibl. Aed. Fl. Eccl. CXCVI}[ | ||
289 | origDate=s. XV] | ||
290 | \DeclareWitness{sO}{O}{Oxoniensis Collegii Reginensis CCCXIV}[ | ||
291 | origDate=s. XV] | ||
292 | \DeclareWitness{sV}{V}{Vaticanus lat. 1652}[ | ||
293 | origDate=s. XV] | ||
294 | \DeclareScholar{sDrak}{\emph{Drakenborch}} | ||
241 | \end{filecontents} | 295 | \end{filecontents} |
242 | \documentclass{ltxdoc} | 296 | \documentclass{ltxdoc} |
243 | %\usepackage[letterpaper,margin=25mm,left=50mm,nohead]{geometry} | 297 | %\usepackage[letterpaper,margin=25mm,left=50mm,nohead]{geometry} |
@@ -268,6 +322,8 @@ along with this program. If not, see | |||
268 | \usepackage{arabluatex} | 322 | \usepackage{arabluatex} |
269 | \usepackage[parnotes=roman,teiexport=tidy]{ekdosis} | 323 | \usepackage[parnotes=roman,teiexport=tidy]{ekdosis} |
270 | \input{ekdosis-cfg} | 324 | \input{ekdosis-cfg} |
325 | \SetxmlBibResource{bibdata} | ||
326 | \usepackage{booktabs} | ||
271 | \usepackage{xltabular} | 327 | \usepackage{xltabular} |
272 | \usepackage[prevent-all]{widows-and-orphans} | 328 | \usepackage[prevent-all]{widows-and-orphans} |
273 | \usepackage[shortcuts,nospacearound]{extdash} | 329 | \usepackage[shortcuts,nospacearound]{extdash} |
@@ -315,6 +371,8 @@ along with this program. If not, see | |||
315 | \labelformat{figure}{fig.~#1} | 371 | \labelformat{figure}{fig.~#1} |
316 | \newcounter{dummy} | 372 | \newcounter{dummy} |
317 | \newcommand{\dummy}{\refstepcounter{dummy}} | 373 | \newcommand{\dummy}{\refstepcounter{dummy}} |
374 | \usepackage[defaultindex=none,citecmd=autocite]{icite} | ||
375 | \bibinput{ekdosis} | ||
318 | \usepackage[nospace,american]{varioref} | 376 | \usepackage[nospace,american]{varioref} |
319 | \usepackage[style=oxnotes-inote,dashed]{biblatex} | 377 | \usepackage[style=oxnotes-inote,dashed]{biblatex} |
320 | \DeclareSourcemap{ | 378 | \DeclareSourcemap{ |
@@ -758,7 +816,8 @@ along with this program. If not, see | |||
758 | %</example> | 816 | %</example> |
759 | % \fi | 817 | % \fi |
760 | % | 818 | % |
761 | % \needspace{4\baselineskip}PDF output:--- | 819 | % \needspace{5\baselineskip} |
820 | % PDF output:--- | ||
762 | % \medskip | 821 | % \medskip |
763 | % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen] | 822 | % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen] |
764 | % \begin{specimen} | 823 | % \begin{specimen} |
@@ -1103,6 +1162,7 @@ along with this program. If not, see | |||
1103 | % place of manuscripts that belong to either family. | 1162 | % place of manuscripts that belong to either family. |
1104 | % | 1163 | % |
1105 | % \paragraph{Scholars} | 1164 | % \paragraph{Scholars} |
1165 | % \label{ref:declare-scholar} | ||
1106 | % \DescribeMacro{\DeclareScholar} \cs{DeclareScholar}\marg{unique | 1166 | % \DescribeMacro{\DeclareScholar} \cs{DeclareScholar}\marg{unique |
1107 | % label}\marg{rendition}\\ | 1167 | % label}\marg{rendition}\\ |
1108 | % The \emph{Conspectus Siglorum} that is placed ahead of the edition | 1168 | % The \emph{Conspectus Siglorum} that is placed ahead of the edition |
@@ -1119,10 +1179,13 @@ along with this program. If not, see | |||
1119 | % \end{enumerate} | 1179 | % \end{enumerate} |
1120 | % | 1180 | % |
1121 | % As \pkg{ekdosis} can include and use \texttt{TEI xml} compliant | 1181 | % As \pkg{ekdosis} can include and use \texttt{TEI xml} compliant |
1122 | % lists of references, it is avisable to use Bib\hologo{(La)TeX} | 1182 | % lists of references,\footnote{See below |
1123 | % labels in the first argument of \cs{DeclareScholar}. Likewise, | 1183 | % \vref{sec:references-cited-works}.} it is avisable to use |
1124 | % shorthands fields from the bibliographical database can be recalled | 1184 | % Bib\hologo{(La)TeX} labels in the first argument of |
1125 | % from within the second argument of \cs{DeclareScholar}:--- | 1185 | % \cs{DeclareScholar}. Likewise, shorthands fields from the |
1186 | % bibliographical database can be recalled from within the second | ||
1187 | % argument of \cs{DeclareScholar}:--- | ||
1188 | % | ||
1126 | % \iffalse | 1189 | % \iffalse |
1127 | %<*example> | 1190 | %<*example> |
1128 | % \fi | 1191 | % \fi |
@@ -1322,6 +1385,7 @@ yesterday. | |||
1322 | % convenient typology. Categories such as lexical, morphological, | 1385 | % convenient typology. Categories such as lexical, morphological, |
1323 | % orthographical and the like may apply. | 1386 | % orthographical and the like may apply. |
1324 | % | 1387 | % |
1388 | % \needspace{11\baselineskip} | ||
1325 | % Finally, four named arguments can be used to insert words at the | 1389 | % Finally, four named arguments can be used to insert words at the |
1326 | % following specific places in the lemma text:\\ | 1390 | % following specific places in the lemma text:\\ |
1327 | % \noindent | 1391 | % \noindent |
@@ -2177,6 +2241,7 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ | |||
2177 | % \fi | 2241 | % \fi |
2178 | % | 2242 | % |
2179 | % \paragraph{Limiting the Number of Entries per Page} | 2243 | % \paragraph{Limiting the Number of Entries per Page} |
2244 | % \label{ref:maxentries} | ||
2180 | % In some instances, it can be useful to set a limit to the number of | 2245 | % In some instances, it can be useful to set a limit to the number of |
2181 | % entries per page that a given layer of critical notes may accept, | 2246 | % entries per page that a given layer of critical notes may accept, |
2182 | % notably when entries are so abundant in number that \pkg{ekdosis} | 2247 | % notably when entries are so abundant in number that \pkg{ekdosis} |
@@ -2367,6 +2432,7 @@ Some \app[type=rec2]{ | |||
2367 | %</example> | 2432 | %</example> |
2368 | % \fi | 2433 | % \fi |
2369 | % | 2434 | % |
2435 | % \needspace{5\baselineskip} | ||
2370 | % PDF output:--- | 2436 | % PDF output:--- |
2371 | % \medskip | 2437 | % \medskip |
2372 | % \resetlinenumber | 2438 | % \resetlinenumber |
@@ -2436,6 +2502,7 @@ text to demonstrate how to insert a note in the argument of the | |||
2436 | %</example> | 2502 | %</example> |
2437 | % \fi | 2503 | % \fi |
2438 | % | 2504 | % |
2505 | % \needspace{5\baselineskip} | ||
2439 | % PDF output:--- | 2506 | % PDF output:--- |
2440 | % \medskip | 2507 | % \medskip |
2441 | % \resetlinenumber | 2508 | % \resetlinenumber |
@@ -2746,6 +2813,7 @@ argument of the | |||
2746 | % \vref{sec:multilayer-apparatus} (multiple-layer apparatus | 2813 | % \vref{sec:multilayer-apparatus} (multiple-layer apparatus |
2747 | % criticus).} | 2814 | % criticus).} |
2748 | % | 2815 | % |
2816 | % \needspace{5\baselineskip} | ||
2749 | % The PDF output with left-to-right apparatus criticus follows:--- | 2817 | % The PDF output with left-to-right apparatus criticus follows:--- |
2750 | % \medskip | 2818 | % \medskip |
2751 | % \resetlinenumber | 2819 | % \resetlinenumber |
@@ -2760,6 +2828,7 @@ argument of the | |||
2760 | % \end{specimen} | 2828 | % \end{specimen} |
2761 | % \end{alignment} | 2829 | % \end{alignment} |
2762 | % | 2830 | % |
2831 | % \needspace{5\baselineskip} | ||
2763 | % And here follows the PDF output with right-to-left apparatus | 2832 | % And here follows the PDF output with right-to-left apparatus |
2764 | % criticus:--- | 2833 | % criticus:--- |
2765 | % \medskip \resetlinenumber | 2834 | % \medskip \resetlinenumber |
@@ -2774,7 +2843,6 @@ argument of the | |||
2774 | % \end{specimen} | 2843 | % \end{specimen} |
2775 | % \end{alignment} | 2844 | % \end{alignment} |
2776 | % | 2845 | % |
2777 | % | ||
2778 | % \subsection{Using \pkg{arabluatex}} | 2846 | % \subsection{Using \pkg{arabluatex}} |
2779 | % \label{sec:using-arabluatex} | 2847 | % \label{sec:using-arabluatex} |
2780 | % \pkg{arabluatex} is a \hologo{LuaLaTeX} package that provides | 2848 | % \pkg{arabluatex} is a \hologo{LuaLaTeX} package that provides |
@@ -2825,6 +2893,7 @@ argument of the | |||
2825 | %</example> | 2893 | %</example> |
2826 | % \fi | 2894 | % \fi |
2827 | % | 2895 | % |
2896 | % \needspace{7\baselineskip} | ||
2828 | % The PDF output with left-to-right apparatus criticus is of course | 2897 | % The PDF output with left-to-right apparatus criticus is of course |
2829 | % the same as above:--- | 2898 | % the same as above:--- |
2830 | % \resetlinenumber | 2899 | % \resetlinenumber |
@@ -3166,7 +3235,69 @@ subtype="arabtex">'inna 'abI kAna mina | |||
3166 | % | 3235 | % |
3167 | % \section{The Tricks of the Trade} | 3236 | % \section{The Tricks of the Trade} |
3168 | % \label{sec:tricks-of-trade} | 3237 | % \label{sec:tricks-of-trade} |
3169 | % | 3238 | % As the |.tex| source file is compiled, \pkg{ekdosis} has to compute |
3239 | % a tremendous amount of data. Most of this work is performed by | ||
3240 | % \textsf{Lua} functions. An edition text narrowed down to a single | ||
3241 | % page needs to be compiled at least three times. On the first run, | ||
3242 | % the apparatus criticus does not show. Instead, \pkg{ekdosis} | ||
3243 | % produces an auxiliary file named \cs{jobname}|.ekd| in which all the | ||
3244 | % entries of the apparatus criticus are collected. Then, on the second | ||
3245 | % run a test is performed on this auxliary file to determine whether | ||
3246 | % there are entries\---and if so, which ones\---to be printed on the | ||
3247 | % current page. At the same time, references to the line numbers are | ||
3248 | % updated if necessary. Then, on the third run, the apparatus criticus | ||
3249 | % is printed. | ||
3250 | % | ||
3251 | % Of course, every change made to the input may similarly require | ||
3252 | % \hologo{LuaLaTeX} to be run three more times to get everything to | ||
3253 | % the right place with the right numbers. | ||
3254 | % | ||
3255 | % In some instances, notably when on a given page entries are very | ||
3256 | % abundant in number, specifically when the edition text is getting | ||
3257 | % close to the bottom of the page, \pkg{ekdosis} may oscillate | ||
3258 | % indefinitely between different sets of page decisions without being | ||
3259 | % able to settle down. The condition may be typically illustrated as | ||
3260 | % follows: after Lua\LaTeX\ has been run, an entry is attached to the | ||
3261 | % last line of the page. As said above, this entry does not show | ||
3262 | % yet. But when it does, if it results in an additional line being | ||
3263 | % printed in the apparatus criticus, the last line of the edition | ||
3264 | % text\---the one the entry was previously attached to\---goes to the | ||
3265 | % next page. As a result, this entry also moves to the next page with | ||
3266 | % the line it belongs to. This point is literally critical, because | ||
3267 | % unless a \cs{pagebreak} is inserted just here so as to keep the | ||
3268 | % contentious line on the next page, \pkg{ekdosis} enters a vicious | ||
3269 | % circle from which it cannot escape, not to mention that right | ||
3270 | % entries with right line numbers cannot come on pages that follow a | ||
3271 | % wrong page either. | ||
3272 | % | ||
3273 | % An alert reader may have guessed that inserting a \cs{pagebreak} is | ||
3274 | % a good way to get out of the vicious circle. And surely, if only a | ||
3275 | % few pages are at stake, this is the way to go. However, | ||
3276 | % \cs{pagebreak} commands should only be inserted when the whole | ||
3277 | % edition text is ready for any subtantial change in the preceding | ||
3278 | % pages may result in pages that break just after they begin. | ||
3279 | % | ||
3280 | % Another way\---should the edition text fall into the vicious circle | ||
3281 | % too often\---is to limit the number of entries per page that a given | ||
3282 | % layer of apparatus criticus may accept as described above | ||
3283 | % \vpageref{ref:maxentries}. As a result, \pkg{ekdosis} will take care | ||
3284 | % of inserting automatic breakpoints between pages whenever the number | ||
3285 | % of entries on a given page reaches the value set as |maxnumber|. | ||
3286 | % | ||
3287 | % |maxnumber| must not be too small: otherwise offensive to look at | ||
3288 | % vertical spaces may come between the edition text and the apparatus | ||
3289 | % criticus. Conversely, |maxnumber| must not be too big: otherwise, | ||
3290 | % should entries overflow on a given page, the edition text and the | ||
3291 | % apparatus criticus may clash. As said above, a couple of clashes can | ||
3292 | % be managed with a couple of manually inserted page breaks. But if | ||
3293 | % there are too many ot them, it is a good indication that the | ||
3294 | % selected value of |maxentries| is too to high. | ||
3295 | % | ||
3296 | % Complex edition texts do have a magic number. An advisable way to | ||
3297 | % figure it out would be to start from a sample of only a few pages, | ||
3298 | % selected as evidence for the complexity of the whole. As only a few | ||
3299 | % pages would need to be compiled, the magic number should emerge | ||
3300 | % quite rapidly. | ||
3170 | % | 3301 | % |
3171 | % \section{\texttt{TEI xml} Output} | 3302 | % \section{\texttt{TEI xml} Output} |
3172 | % \label{sec:teixml-output} | 3303 | % \label{sec:teixml-output} |
@@ -3227,7 +3358,7 @@ subtype="arabtex">'inna 'abI kAna mina | |||
3227 | % \paragraph{Validation of the \texttt{TEI xml} Structure} | 3358 | % \paragraph{Validation of the \texttt{TEI xml} Structure} |
3228 | % The reference tool that the author relies on is that provided by the | 3359 | % The reference tool that the author relies on is that provided by the |
3229 | % \emph{\texttt{TEI} by Example Project}.\footnote{\cite{TBE}. | 3360 | % \emph{\texttt{TEI} by Example Project}.\footnote{\cite{TBE}. |
3230 | % \texttt{TEI} validator: | 3361 | % The \texttt{TEI} validator is here: |
3231 | % \url{http://teibyexample.com/xquery/TBEvalidator.xq}.} As for | 3362 | % \url{http://teibyexample.com/xquery/TBEvalidator.xq}.} As for |
3232 | % \pkg{ekdosis}, it is designed to produce on request, in addition to | 3363 | % \pkg{ekdosis}, it is designed to produce on request, in addition to |
3233 | % an edition in print, a \texttt{TEI xml} compliant output file. That | 3364 | % an edition in print, a \texttt{TEI xml} compliant output file. That |
@@ -3241,18 +3372,947 @@ subtype="arabtex">'inna 'abI kAna mina | |||
3241 | % of which are to be translated into \texttt{xml} elements, as will be | 3372 | % of which are to be translated into \texttt{xml} elements, as will be |
3242 | % illustrated by the following. | 3373 | % illustrated by the following. |
3243 | % | 3374 | % |
3244 | % Converting a \LaTeX\ document into \texttt{TEI xml} is quite an | 3375 | % Converting a \LaTeX\ document into \texttt{TEI xml} can be quite an |
3245 | % intricate business. In many cases, \LaTeX\ strings are found within | 3376 | % intricate business. In many cases, however, \LaTeX\ strings are |
3246 | % environments or groups: whether such groups are delimited by opening | 3377 | % found within environments or groups that are easy to convert into |
3247 | % and closing braces or by explicit \cs{begin} \dots\ \cs{end} | 3378 | % \texttt{TEI} equivalents: unless instructed otherwise, whether such |
3248 | % commands, | 3379 | % groups are delimited by opening and closing braces or by explicit |
3380 | % \cs{begin} \dots\ \cs{end} commands, \pkg{ekdosis} translates them | ||
3381 | % into |xml| so that for example \cs{emph}|{word}| and | ||
3382 | % \cs{begin}|{quote}| \meta{quoted words} \cs{end}|{quote}| become | ||
3383 | % |<emph>| \meta{word} |</emph>| and |<quote>| \meta{quoted words} | ||
3384 | % |</quote>| respectively. | ||
3385 | % | ||
3386 | % But \LaTeX\ does not place everything into groups or | ||
3387 | % environments. To take here but a few examples, sectional divisions | ||
3388 | % are marked in \LaTeX\ with \enquote{open} commands such as | ||
3389 | % \cs{chapter} or \cs{section} with no clear indication where the | ||
3390 | % closure of divisions occurs, contrary to \texttt{TEI xml} markup | ||
3391 | % with numered or un-numbered |<div>| elements allowed to nest | ||
3392 | % recursively. As regards running paragraphs of text, the situation is | ||
3393 | % even worse than in the latter case, as the following simple example | ||
3394 | % shows:--- | ||
3395 | % | ||
3396 | % \iffalse | ||
3397 | %<*example> | ||
3398 | % \fi | ||
3399 | \begin{minted}{latex} | ||
3400 | \begin{document} | ||
3401 | \begin{ekdosis} | ||
3402 | ... | ||
3403 | |||
3404 | ... These are the final words of some section in the body text. | ||
3405 | |||
3406 | \section{New Section} | ||
3407 | |||
3408 | Here is how some new section begins... | ||
3409 | |||
3410 | ... Final words. | ||
3411 | \section{Other Section} | ||
3412 | Opening words of the section... | ||
3413 | |||
3414 | ... Final words | ||
3415 | |||
3416 | \section{Other Section} | ||
3417 | Opening words... | ||
3418 | |||
3419 | ... Final words. | ||
3420 | \end{ekdosis} | ||
3421 | \end{document} | ||
3422 | \end{minted} | ||
3423 | % \iffalse | ||
3424 | %</example> | ||
3425 | % \fi | ||
3426 | % | ||
3427 | % Obviously, construing this \LaTeX\ source file into \texttt{TEI xml} | ||
3428 | % is a fairly complex task. For example, line~6 only closes a | ||
3429 | % paragraph for line~7 opens a division (hence |</p><div1>|), line~8 | ||
3430 | % only opens a paragraph just after the heading of the section (hence | ||
3431 | % |</head><p>|) while line~14 both closes the foregoing paragraph and | ||
3432 | % opens a new one (hence |</p><p>|), contrary to line~16 which both | ||
3433 | % closes a paragraph and a sectional division (hence |</p></div1>|), | ||
3434 | % not to mention lines~20--1, where notwithstanding the absence of | ||
3435 | % blank line or any other indication, | ||
3436 | % |</p></div1></body></text></TEI>| is needed. | ||
3437 | % | ||
3438 | % \pkg{ekdosis} has been designed to implement this task through | ||
3439 | % \textsf{Lua} functions which involve string matching (both forward | ||
3440 | % and reverse matching) and recursions. | ||
3441 | % | ||
3442 | % \paragraph{The \texttt{xml:id} Attribute} | ||
3443 | % As a general rule, the |xml:id| global attribute must be unique for | ||
3444 | % the element that bears the attribute. Furthermore, it must begin | ||
3445 | % with a letter or an underscore and contain no characters other that | ||
3446 | % letters, digits, hyphens underscores and full stops. \pkg{ekdosis} | ||
3447 | % issues a warning when it finds that any \meta{unique id} of | ||
3448 | % \meta{unique label} expected in the first argument of | ||
3449 | % \cs{DeclareWitness}, \cs{DeclareHand} or \cs{DeclareScholar} is not | ||
3450 | % unique or breaks the rules just described, but does not prevent the | ||
3451 | % |.tex| source file from compiling. Instead, it prints the string | ||
3452 | % |<??>| in place of the expected formatted siglum so that the error | ||
3453 | % in the |.tex| source file can be easily spotted and corrected. | ||
3454 | % | ||
3455 | % \danger As the \meta{unique id} declared with \cs{DeclareShorthand} | ||
3456 | % is not to be exported in the \texttt{TEI xml} outputfile, | ||
3457 | % \pkg{ekdosis} checks neither its uniqueness nor its validness. | ||
3458 | % | ||
3459 | % \danger It must be noted that \LaTeX\ labels that are provided in | ||
3460 | % commands such as \cs{label}, \cs{cite} and the like must also be | ||
3461 | % unique in the document. As \LaTeX\ will issue warnings if it finds | ||
3462 | % duplicates, \cs{ekdosis} does not check their uniqueness but will | ||
3463 | % issue warnings if such labels contain invalid strings. | ||
3464 | % | ||
3465 | % \paragraph{\texttt{TEI xml} Export Settings} | ||
3466 | % \DescribeMacro{\SetTEIxmlExport} \cs{SetTEIxmlExport}\marg{csv list | ||
3467 | % of options} can be used in the preamble or at any point of the | ||
3468 | % document, except inside environments set to receive an apparatus | ||
3469 | % criticus, namely the \env{ekdosis} environment or any other similar | ||
3470 | % environment declared by means of \cs{DeclareApparatus}.\footnote{See | ||
3471 | % above \vref{sec:declaring-layers}.} At the time of writing, there is | ||
3472 | % only one option, as follows:---\\ | ||
3473 | % \DescribeOption{autopar} |autopar|$=$\verb+true|false+ | ||
3474 | % \hfill\tcboxverb{Default: true}\\ | ||
3475 | % The algorithm described above applies for edition texts composed in | ||
3476 | % running paragraphs or in lines of poetry, but it may fail to produce | ||
3477 | % a valid \texttt{TEI xml} output with other arrangements, such as | ||
3478 | % performance texts or transcriptions of speech for which the | ||
3479 | % \texttt{TEI} Guidelines define specific rules. |autopar=false| | ||
3480 | % instructs \pkg{ekdosis} to ignore blank lines in the |.tex| source | ||
3481 | % file as markers for paragraph boundaries. As a result, each | ||
3482 | % paragraph of the edition text must be found within an environment | ||
3483 | % associated with the \texttt{xml} |<p>| element, such as \env{ekdpar} | ||
3484 | % or any other environment declared as such by means of \cs{EnvtoTEI} | ||
3485 | % described below in \vref{sec:new-cmds-envs}. A typical use case of | ||
3486 | % |autopar=false| is provided below in | ||
3487 | % \vref{sec:specific-tei-modules}. | ||
3488 | % | ||
3489 | % \DescribeEnv{ekdpar} \cs{begin}|{ekdpar}| \dots\ \cs{end}|{ekdpar}| | ||
3490 | % is a simple environment that does nothing but insert \cs{par} | ||
3491 | % primitives. It can be used to instruct \pkg{ekdosis} to place | ||
3492 | % paragraphs within |<p>| elements when |autopar| has been set to | ||
3493 | % |false| by means of \cs{SetTEIxmlExport} described above. | ||
3494 | % | ||
3495 | % \subsection{Routine \LaTeX\ Commands and Environments} | ||
3496 | % \label{sec:routine-cmds} | ||
3497 | % The list of \LaTeX\ commands known by \pkg{ekdosis} at the time of | ||
3498 | % writing follows. To this list must be added the \LaTeX\ standard | ||
3499 | % commands that are used for sectional divisions as described above in | ||
3500 | % \vref{sec:latex-divs} and most of the commands provided by the | ||
3501 | % \pkg{arabluatex} and \pkg{icite}\footcite{icite} packages. Standard | ||
3502 | % citation commands are also supported as will be described below in | ||
3503 | % \vref{sec:citation-cmds}:--- | ||
3504 | % | ||
3505 | % \begin{xltabular}{0.825\linewidth}{XX} | ||
3506 | % \toprule | ||
3507 | % \LaTeX\ command & \texttt{TEI xml} element\\ | ||
3508 | % \midrule\endhead | ||
3509 | % \cs{textsuperscript}|{}| & |<hi rend="sup"></hi>| \\ | ||
3510 | % \cs{textsubscript}|{}| & |<hi rend="sub"></hi>| \\ | ||
3511 | % \cs{textbf}|{}| & |<hi rend="bold"></hi>| \\ | ||
3512 | % \cs{textit}|{}| & |<hi rend="italic"></hi>| \\ | ||
3513 | % \cs{textsc}|{}| & |<hi rend="smallcaps"></hi>| \\ | ||
3514 | % \cs{textsf}|{}| & |<hi rend="sf"></hi>| \\ | ||
3515 | % \cs{footnote}|{}| & |<note place="bottom"></note>| \\ | ||
3516 | % \cs{enquote}\meta{*}|{}| & |<quote></quote>| \\ | ||
3517 | % \cs{label}|{label}| & |<anchor xml:id="label"/>| \\ | ||
3518 | % \cs{linelabel}|{label}| & |<anchor xml:id="label"/>| \\ | ||
3519 | % \cs{ref}|{label}| & |<ptr ="#label"/>| \\ | ||
3520 | % \cs{pageref}|{label}| & |<ptr ="#label"/>| \\ | ||
3521 | % \cs{vref}|{label}| & |<ptr ="#label"/>| \\ | ||
3522 | % \cs{vpageref}|{label}| & |<ptr ="#label"/>| \\ | ||
3523 | % \cs{pagebreak}\meta{\oarg{1-4}} & no output \\ | ||
3524 | % \cs{mbox}|{}| & no output \\ | ||
3525 | % \bottomrule | ||
3526 | % \end{xltabular} | ||
3527 | % | ||
3528 | % As for environments:--- | ||
3529 | % | ||
3530 | % \begin{xltabular}{0.825\linewidth}{XX} | ||
3531 | % \toprule | ||
3532 | % \LaTeX\ environment & \texttt{TEI xml} element\\ | ||
3533 | % \midrule\endhead | ||
3534 | % |flushright| & |<p rend="align(right)"></p>| \\ | ||
3535 | % |flushleft| & |<p rend="align(left)"></p>| \\ | ||
3536 | % |center| & |<p rend="align(center)"></p>| \\ | ||
3537 | % |quotation| & |<quote></quote>| \\ | ||
3538 | % |quoting| & |<quote></quote>| \\ | ||
3539 | % |ekdpar| & |<p></p>| \\ | ||
3540 | % |ekdverse| & |<lg></lg>| \\ | ||
3541 | % |verse| & |<lg></lg>| \\ | ||
3542 | % \bottomrule | ||
3543 | % \end{xltabular} | ||
3544 | % | ||
3545 | % Regarding other, very frequently used commands or environments, some | ||
3546 | % do not need to be inserted in the translation tables: as already | ||
3547 | % said above, \pkg{ekdosis} converts by default the original names of | ||
3548 | % these into \texttt{xml} elements. For instance, \cs{emph}|{}| and | ||
3549 | % \cs{begin}|{quote}| \dots\ \cs{end}|{quote}| will result in | ||
3550 | % |<emph></emph>| and |<quote></quote>| respectively. | ||
3551 | % | ||
3552 | % For the same simple reason, if one wishes to have words within a | ||
3553 | % \texttt{TEI xml} element that does not have any \LaTeX\ equivalent, | ||
3554 | % all is needed is to define an inoperative \LaTeX\ command named | ||
3555 | % after the \texttt{TEI} element, like so:--- | ||
3556 | % | ||
3557 | % \iffalse | ||
3558 | %<*example> | ||
3559 | % \fi | ||
3560 | \begin{minted}[linenos=false]{latex} | ||
3561 | % Preamble: | ||
3562 | \newcommand{\mentioned}[1]{#1} | ||
3563 | |||
3564 | % Document: | ||
3565 | |||
3566 | Our usage corresponds to the \mentioned{aggregate} of many | ||
3567 | mathematical writings and to the sense of \mentioned{class} found in | ||
3568 | older logical writings. | ||
3569 | \end{minted} | ||
3570 | % \iffalse | ||
3571 | %</example> | ||
3572 | % \fi | ||
3573 | % | ||
3574 | % \texttt{TEI xml} output:--- | ||
3575 | % | ||
3576 | % \iffalse | ||
3577 | %<*example> | ||
3578 | % \fi | ||
3579 | \begin{minted}[linenos=false]{xml} | ||
3580 | <p>Our usage corresponds to the <mentioned>aggregate</mentioned> of | ||
3581 | many mathematical writings and to the sense of | ||
3582 | <mentioned>class</mentioned> found in older logical writings.</p> | ||
3583 | \end{minted} | ||
3584 | % \iffalse | ||
3585 | %</example> | ||
3586 | % \fi | ||
3587 | % | ||
3588 | % Of course, it is also possible to have the \enquote{mentioned} words | ||
3589 | % printed in a different font family:--- | ||
3590 | % | ||
3591 | % \iffalse | ||
3592 | %<*example> | ||
3593 | % \fi | ||
3594 | \begin{minted}[linenos=false]{latex} | ||
3595 | \newcommand{\mentioned}[1]{\textsf{#1}} | ||
3596 | \end{minted} | ||
3597 | % \iffalse | ||
3598 | %</example> | ||
3599 | % \fi | ||
3600 | % | ||
3601 | % This command will print them in a sans serif font family, with the | ||
3602 | % exact same \texttt{TEI xml} output as above. | ||
3603 | % | ||
3604 | % \subsection{Processing New Commands or Environments} | ||
3605 | % \label{sec:new-cmds-envs} | ||
3606 | % The following three commands are provided to instruct \pkg{ekdosis} | ||
3607 | % how to convert unknown or unusual \hologo{(La)TeX} commands or | ||
3608 | % environments into \texttt{TEI xml} equivalents. | ||
3609 | % | ||
3610 | % \DescribeMacro{\TeXtoTEI} \cs{TeXtoTEI}\marg{csname}\marg{TEI | ||
3611 | % element}\oarg{TEI attribute(s)}\\ | ||
3612 | % \cs{TeXtoTEI} takes two mandatory arguments and one optional | ||
3613 | % argument, namely: the control sequence name to be converted, the | ||
3614 | % \texttt{TEI} element it is to be converted into and any additional | ||
3615 | % \texttt{xml} attributes to be appended to the opening \texttt{TEI} | ||
3616 | % element. For example, the \cs{sidenote} command that is provided by | ||
3617 | % the \cs{sidenotes} package can be processed like so:--- | ||
3618 | % | ||
3619 | % \iffalse | ||
3620 | %<*example> | ||
3621 | % \fi | ||
3622 | \begin{minted}[linenos=false]{latex} | ||
3623 | % Preamble: | ||
3624 | \TeXtoTEI{sidenote}{note}[place="margin"] | ||
3625 | |||
3626 | % Document: | ||
3627 | \begin{ekdosis} | ||
3628 | \begin{ekdverse} | ||
3629 | The self-same moment I could pray;\sidenote{The spell begins to | ||
3630 | break}\footnote{The turning point of the poem...} | ||
3631 | \end{ekdverse} | ||
3632 | \end{ekdosis} | ||
3633 | \end{minted} | ||
3634 | % \iffalse | ||
3635 | %</example> | ||
3636 | % \fi | ||
3637 | % | ||
3638 | % \texttt{TEI xml} output:--- | ||
3639 | % | ||
3640 | % \iffalse | ||
3641 | %<*example> | ||
3642 | % \fi | ||
3643 | \begin{minted}[linenos=false]{xml} | ||
3644 | <lg> | ||
3645 | <l>The self-same moment I could pray; | ||
3646 | <note place="margin">The spell begins to break</note> | ||
3647 | <note place="bottom">The turning point of the | ||
3648 | poem...</note></l> | ||
3649 | </lg> | ||
3650 | \end{minted} | ||
3651 | % \iffalse | ||
3652 | %</example> | ||
3653 | % \fi | ||
3654 | % | ||
3655 | % Even more subtly, provided that the code |#STC| points to some more | ||
3656 | % information identifying the agency concerned:\footnote{At the time | ||
3657 | % of writing, \enquote*{scholars} can be declared with | ||
3658 | % \cs{DeclareScholar} as described above | ||
3659 | % \vpageref{ref:declare-scholar}. Then the unique ID used in the first | ||
3660 | % argument of this command can point to the list of references | ||
3661 | % inserted by \pkg{ekdosis} in the back matter section of the | ||
3662 | % \texttt{TEI} ouput file. See below \vref{sec:references-cited-works} | ||
3663 | % for more information on how to do this.}--- | ||
3664 | % | ||
3665 | % \iffalse | ||
3666 | %<*example> | ||
3667 | % \fi | ||
3668 | \begin{minted}[linenos=false]{latex} | ||
3669 | % Preamble: | ||
3670 | \usepackage{sidenotes} | ||
3671 | \usepackage[teiexport=tidy]{ekdosis} | ||
3672 | |||
3673 | \TeXtoTEI{sidenote}{note}[place="margin"] | ||
3674 | |||
3675 | \newcommand{\STCsnote}[1]{\sidenote{#1}} | ||
3676 | \TeXtoTEI{STCsnote}{note}[place="margin" resp="#STC"] | ||
3677 | |||
3678 | % Document: | ||
3679 | \begin{ekdosis} | ||
3680 | \begin{ekdverse} | ||
3681 | The self-same moment I could pray;\STCsnote{The spell begins to | ||
3682 | break}\footnote{The turning point of the poem...} | ||
3683 | \end{ekdverse} | ||
3684 | \end{ekdosis} | ||
3685 | \end{minted} | ||
3686 | % \iffalse | ||
3687 | %</example> | ||
3688 | % \fi | ||
3689 | % | ||
3690 | % \texttt{TEI xml} output:--- | ||
3691 | % | ||
3692 | % \iffalse | ||
3693 | %<*example> | ||
3694 | % \fi | ||
3695 | \begin{minted}[linenos=false]{xml} | ||
3696 | <lg> | ||
3697 | <l>The self-same moment I could pray; | ||
3698 | <note place="margin" resp="#STC">The spell begins to | ||
3699 | break</note> | ||
3700 | <note place="bottom">The turning point of the | ||
3701 | poem...</note></l> | ||
3702 | </lg> | ||
3703 | \end{minted} | ||
3704 | % \iffalse | ||
3705 | %</example> | ||
3706 | % \fi | ||
3707 | % | ||
3708 | % \DescribeMacro{\EnvtoTEI} \DescribeMacro{\EnvtoTEI*} | ||
3709 | % \cs{EnvtoTEI}\meta{*}\marg{env name}\marg{TEI element}\oarg{TEI | ||
3710 | % attribute(s)}\\ | ||
3711 | % \cs{EnvtoTEI} instructs \pkg{ekdosis} how to convert \LaTeX\ | ||
3712 | % environments into \texttt{TEI xml} equivalents. It takes two | ||
3713 | % mandatory arguments and one optional argument, namely the name of | ||
3714 | % the \LaTeX\ environment to be converted, the \texttt{TEI} element it | ||
3715 | % is to be converted into and any additional attributes to be appended | ||
3716 | % to the \texttt{TEI} opening element. \cs{EnvtoTEI*} is restricted to | ||
3717 | % \texttt{TEI} elements that must never appear within |<p>| elements, | ||
3718 | % such as |<p>| itself, |<div>|, |<lg>| and the like. The following | ||
3719 | % example illustrates how \cs{EnvtoTEI} can be used conjointly with | ||
3720 | % \pkg{babel} to convey information about the languages used from | ||
3721 | % \LaTeX\ to \texttt{TEI}:--- | ||
3722 | % | ||
3723 | % \iffalse | ||
3724 | %<*example> | ||
3725 | % \fi | ||
3726 | \begin{minted}[linenos=false]{latex} | ||
3727 | % Preamble: | ||
3728 | % Use babel and babeltags: | ||
3729 | \usepackage[greek.ancient, english]{babel} | ||
3730 | \babeltags{ancientgreek = greek} | ||
3731 | |||
3732 | \EnvtoTEI{ancientgreek}{p}[xml:lang="grc"] | ||
3733 | |||
3734 | % Document: | ||
3735 | \begin{ekdosis} | ||
3736 | \begin{ancientgreek} | ||
3737 | περὶ πολλοῦ ἂν ποιησαίμην, ὦ ἄνδρες, τὸ τοιούτους ὑμᾶς ἐμοὶ | ||
3738 | δικαστὰς περὶ τούτου τοῦ πράγματος γενέσθαι, οἷοίπερ ἂν ὑμῖν | ||
3739 | αὐτοῖς εἴητε τοιαῦτα πεπονθότες... | ||
3740 | \end{ancientgreek} | ||
3741 | \end{ekdosis} | ||
3742 | \end{minted} | ||
3743 | % \iffalse | ||
3744 | %</example> | ||
3745 | % \fi | ||
3746 | % | ||
3747 | % \texttt{TEI xml} output:--- | ||
3748 | % | ||
3749 | % \iffalse | ||
3750 | %<*example> | ||
3751 | % \fi | ||
3752 | \begin{minted}[linenos=false]{xml} | ||
3753 | <p xml:lang="grc">περὶ πολλοῦ ἂν ποιησαίμην, ὦ ἄνδρες, τὸ | ||
3754 | τοιούτους ὑμᾶς ἐμοὶ δικαστὰς περὶ τούτου τοῦ πράγματος | ||
3755 | γενέσθαι, οἷοίπερ ἂν ὑμῖν αὐτοῖς εἴητε τοιαῦτα πεπονθότες...</p> | ||
3756 | \end{minted} | ||
3757 | % \iffalse | ||
3758 | %</example> | ||
3759 | % \fi | ||
3760 | % | ||
3761 | % \DescribeMacro{\TeXtoTEIPatt} | ||
3762 | % \cs{TeXtoTEIPatt}\marg{\TeX\ pattern}\marg{TEI pattern}\\ | ||
3763 | % Finally, this more flexible\---and more delicate to | ||
3764 | % handle\---command uses pattern matching to instruct \pkg{ekdosis} | ||
3765 | % how to convert \hologo{(La)TeX} commands into \texttt{TEI} | ||
3766 | % equivalents. In the first mandatory argument, strings to be captured | ||
3767 | % are marked in sequence with numbers prefixed by |#|, like so: |#1|, | ||
3768 | % |#2|, |#3| and so forth. Then, in the second mandatory argument, the | ||
3769 | % strings captured are inserted where each of them is expected in | ||
3770 | % the \texttt{TEI} element. | ||
3771 | % | ||
3772 | % \danger Strings must be entered exactly as \pkg{ekdosis} will find | ||
3773 | % them as the |.tex| source file is compiled. Specifically, | ||
3774 | % \emph{control sequences}, namely the coded commands immediately | ||
3775 | % preceded by `\verb+\+' are always found followed by a space. For | ||
3776 | % instance, |\emph{}| will be seen and processed by \pkg{ekdosis} as | ||
3777 | % \verb*|\emph {}|. | ||
3778 | % | ||
3779 | % The following example illustrates how \pkg{ekdosis} can be | ||
3780 | % instructed to process the | ||
3781 | % \cs{textcolor}\allowbreak\marg{color}\marg{text} command:--- | ||
3782 | % | ||
3783 | % \iffalse | ||
3784 | %<*example> | ||
3785 | % \fi | ||
3786 | \begin{minted}[linenos=false]{latex} | ||
3787 | \TeXtoTEIPatt{\textcolor {#1}{#2}}{<hi rend="#1">#2</hi>} | ||
3788 | |||
3789 | Sample text with a \textcolor{red}{word} in red. | ||
3790 | \end{minted} | ||
3791 | % \iffalse | ||
3792 | %</example> | ||
3793 | % \fi | ||
3794 | % | ||
3795 | % \iffalse | ||
3796 | %<*example> | ||
3797 | % \fi | ||
3798 | \begin{minted}[linenos=false]{xml} | ||
3799 | <p>Sample text with a | ||
3800 | <hi rend="red">word</hi>in red.</p> | ||
3801 | \end{minted} | ||
3802 | % \iffalse | ||
3803 | %</example> | ||
3804 | % \fi | ||
3805 | % | ||
3806 | % \subsection{Specific \texttt{TEI} Modules} | ||
3807 | % \label{sec:specific-tei-modules} | ||
3808 | % The following example illustrates how \pkg{ekdosis} can be adapted | ||
3809 | % in a straightforward way to modules provided by the \texttt{TEI} for | ||
3810 | % encoding specific texts such as transcriptions of | ||
3811 | % speech.\footnote{See | ||
3812 | % \url{https://tei-c.org/release/doc/tei-p5-doc/en/html/TS.html}.} The | ||
3813 | % technique applied below uses \cs{EnvtoTEI} conjointly with | ||
3814 | % \cs{SetTEIxmlExport}|{autopar=|\allowbreak|false}|:--- | ||
3815 | % | ||
3816 | % \iffalse | ||
3817 | %<*example> | ||
3818 | % \fi | ||
3819 | \begin{minted}{latex} | ||
3820 | % Preamble: | ||
3821 | \newenvironment{speech}{\par}{\par} | ||
3822 | \newcommand{\speaker}[1]{\textbf{#1}\par} | ||
3823 | \EnvtoTEI{speech}{sp} | ||
3824 | |||
3825 | \SetTEIxmlExport{autopar=false} | ||
3826 | |||
3827 | % Document: | ||
3828 | \begin{ekdosis} | ||
3829 | \begin{speech} | ||
3830 | \speaker{Σωκράτης} | ||
3831 | \begin{ekdpar} | ||
3832 | κατέβην χθὲς εἰς Πειραιᾶ μετὰ Γλαύκωνος τοῦ Ἀρίστωνος | ||
3833 | προσευξόμενός τε τῇ θεῷ καὶ ἅμα τὴν ἑορτὴν βουλόμενος θεάσασθαι | ||
3834 | τίνα τρόπον ποιήσουσιν ἅτε νῦν πρῶτον ἄγοντες. καλὴ μὲν οὖν μοι | ||
3835 | καὶ ἡ τῶν ἐπιχωρίων πομπὴ ἔδοξεν εἶναι, οὐ μέντοι ἧττον ἐφαίνετο | ||
3836 | πρέπειν ἣν οἱ Θρᾷκες ἔπεμπον. | ||
3837 | \end{ekdpar} | ||
3838 | \end{speech} | ||
3839 | \end{ekdosis} | ||
3840 | \end{minted} | ||
3841 | % \iffalse | ||
3842 | %</example> | ||
3843 | % \fi | ||
3844 | % | ||
3845 | % \begin{remarks} | ||
3846 | % \item Lines~2--3 define a basic environment meant to contain | ||
3847 | % indivivual speeches and a command to hold the name of the | ||
3848 | % speaker. This name is printed in bold face and followed by a new | ||
3849 | % paragraph in the PDF output. | ||
3850 | % \item Line~4 instructs \pkg{ekdosis} to convert \env{speech} \LaTeX\ | ||
3851 | % environments into |<sp>| \texttt{TEI xml} elements. | ||
3852 | % \item Line~6 disables the |autopar| algorithm that \cs{ekdosis} | ||
3853 | % provides by default for running paragraphs of text. As a | ||
3854 | % consequence, \env{ekdpar} is used to mark the paragraphs. | ||
3855 | % \end{remarks} | ||
3856 | % | ||
3857 | % PDF output:--- | ||
3858 | % \medskip | ||
3859 | % | ||
3860 | % \SetTEIxmlExport{autopar=false} | ||
3861 | % \begingroup | ||
3862 | % \newenvironment{speech}{\par\selectlanguage{greek}}{\par} | ||
3863 | % \newcommand{\speaker}[1]{\textbf{#1}\par} | ||
3864 | % \EnvtoTEI{speech}{sp} | ||
3865 | % \resetlinenumber | ||
3866 | % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen] | ||
3867 | % \begin{specimen} | ||
3868 | % \begin{speech} | ||
3869 | % \speaker{Σωκράτης} | ||
3870 | % \begin{ekdpar} | ||
3871 | % κατέβην χθὲς εἰς Πειραιᾶ μετὰ Γλαύκωνος τοῦ Ἀρίστωνος | ||
3872 | % προσευξόμενός τε τῇ θεῷ καὶ ἅμα τὴν ἑορτὴν βουλόμενος θεάσασθαι | ||
3873 | % τίνα τρόπον ποιήσουσιν ἅτε νῦν πρῶτον ἄγοντες. καλὴ μὲν οὖν μοι | ||
3874 | % καὶ ἡ τῶν ἐπιχωρίων πομπὴ ἔδοξεν εἶναι, οὐ μέντοι ἧττον ἐφαίνετο | ||
3875 | % πρέπειν ἣν οἱ Θρᾷκες ἔπεμπον. | ||
3876 | % \end{ekdpar} | ||
3877 | % \end{speech} | ||
3878 | % \end{specimen} | ||
3879 | % \end{alignment} | ||
3880 | % \endgroup | ||
3881 | % \SetTEIxmlExport{autopar=true} | ||
3882 | % | ||
3883 | % \texttt{TEI xml} output:--- | ||
3884 | % | ||
3885 | % \iffalse | ||
3886 | %<*example> | ||
3887 | % \fi | ||
3888 | \begin{minted}[linenos=false]{xml} | ||
3889 | <sp> | ||
3890 | <speaker>Σωκράτης</speaker> | ||
3891 | <p>κατέβην χθὲς εἰς Πειραιᾶ μετὰ Γλαύκωνος τοῦ Ἀρίστωνος | ||
3892 | προσευξόμενός τε τῇ θεῷ καὶ ἅμα τὴν ἑορτὴν βουλόμενος | ||
3893 | θεάσασθαι τίνα τρόπον ποιήσουσιν ἅτε νῦν πρῶτον ἄγοντες. | ||
3894 | καλὴ μὲν οὖν μοι καὶ ἡ τῶν ἐπιχωρίων πομπὴ ἔδοξεν εἶναι, οὐ | ||
3895 | μέντοι ἧττον ἐφαίνετο πρέπειν ἣν οἱ Θρᾷκες ἔπεμπον.</p> | ||
3896 | </sp> | ||
3897 | \end{minted} | ||
3898 | % \iffalse | ||
3899 | %</example> | ||
3900 | % \fi | ||
3901 | % | ||
3902 | % \subsection{References to Cited Works} | ||
3903 | % \label{sec:references-cited-works} | ||
3904 | % A full example of what is technically called a \emph{Conspectus | ||
3905 | % Siglorum} can be found above in \vref{sec:print-witnesses}. Such a | ||
3906 | % list of manuscript sigla should be found immediately before the | ||
3907 | % edition text. Traditionally, this section is followed by a list of | ||
3908 | % other sources used to establish the text, so that the edited text is | ||
3909 | % in the end established both from manuscript evidence (the | ||
3910 | % \enquote{witnesses}) and other works based on a scholarly approach | ||
3911 | % of the text (the \enquote{sources}) which are called in Latin | ||
3912 | % \emph{Editiones uel Studia}. As a consequence of this classification | ||
3913 | % as \enquote{witness} or \enquote{source}, the former must go within | ||
3914 | % the |<listWit>| element of the \texttt{TEI} header, whereas the | ||
3915 | % latter is to be found within the |<listBibl>| element. | ||
3916 | % | ||
3917 | % \DescribeMacro{\SetxmlBibResource} | ||
3918 | % \cs{SetxmlBibResource}\marg{basename} is a preamble-only command. If | ||
3919 | % a base name for a \texttt{TEI xml} compliant bibliographical | ||
3920 | % database be provided, \pkg{ekdosis} will use it and insert formatted | ||
3921 | % data in the back matter section of its own \texttt{TEI xml} output | ||
3922 | % file, as |<biblStruct>| elements within a |listBibl| section. | ||
3923 | % | ||
3924 | % As an example, the following Bib\hologo{(La)TeX} entry and its | ||
3925 | % \texttt{TEI} equivalent follow:\footnote{\label{fn:zotero}To the | ||
3926 | % author's knowledge, \textsf{Zotero} (\url{https://www.zotero.org}) | ||
3927 | % provides excellent \texttt{TEI xml} output from Bib\hologo{(La)TeX} | ||
3928 | % input files.}--- | ||
3929 | % | ||
3930 | % \iffalse | ||
3931 | %<*example> | ||
3932 | % \fi | ||
3933 | \begin{minted}{bibtex} | ||
3934 | @Book{Drak, | ||
3935 | title = {Punicorum Libri Septemdecim}, | ||
3936 | author = {Silius Italicus, Tiberius Catius}, | ||
3937 | editor = {Drakenborch, Arnold}, | ||
3938 | date = {1717}, | ||
3939 | publisher = {Trajecti ad Rhenum}, | ||
3940 | location = {Utrecht} | ||
3941 | } | ||
3942 | \end{minted} | ||
3943 | % \iffalse | ||
3944 | %</example> | ||
3945 | % \fi | ||
3946 | % | ||
3947 | % \iffalse | ||
3948 | %<*example> | ||
3949 | % \fi | ||
3950 | \begin{minted}{xml} | ||
3951 | <?xml version="1.0" encoding="UTF-8"?> | ||
3952 | <listBibl xmlns="http://www.tei-c.org/ns/1.0"> | ||
3953 | <biblStruct type="book" xml:id="Drak"> | ||
3954 | <monogr> | ||
3955 | <title level="m">Punicorum libri septemdecim</title> | ||
3956 | <author> | ||
3957 | <forename>Tiberius Catius</forename> | ||
3958 | <surname>Silius Italicus</surname> | ||
3959 | </author> | ||
3960 | <editor> | ||
3961 | <forename>Arnold</forename> | ||
3962 | <surname>Drakenborch</surname> | ||
3963 | </editor> | ||
3964 | <imprint> | ||
3965 | <pubPlace>Utrecht</pubPlace> | ||
3966 | <publisher>Trajecti ad Rhenum</publisher> | ||
3967 | <date>1717</date> | ||
3968 | </imprint> | ||
3969 | </monogr> | ||
3970 | </biblStruct> | ||
3971 | </listBibl> | ||
3972 | \end{minted} | ||
3973 | % \iffalse | ||
3974 | %</example> | ||
3975 | % \fi | ||
3976 | % | ||
3977 | % \danger As can be seen, the same string |Drak| is used as a label in | ||
3978 | % the Bib\hologo{(La)TeX} file (l.~1) and an |xml:id| in the | ||
3979 | % \texttt{TEI} file (l.~3). This same label must be used again in the | ||
3980 | % preamble of the |.tex| source file to declare Arnold Drakenborch as a | ||
3981 | % scholar,\footnote{See above \vpageref{ref:declare-scholar}.} like | ||
3982 | % so:--- | ||
3983 | % | ||
3984 | % \iffalse | ||
3985 | %<*example> | ||
3986 | % \fi | ||
3987 | \begin{minted}{latex} | ||
3988 | % Use 'bibl.xml' as a TEI xml bibliographical database: | ||
3989 | \SetxmlBibResource{bibl} % 'bibl' is the basename of 'bibl.xml' | ||
3990 | |||
3991 | % Declare A. Drakenborch as scholar: | ||
3992 | \DeclareScholar{Drak}{\emph{Drakenborch}} | ||
3993 | \end{minted} | ||
3994 | % \iffalse | ||
3995 | %</example> | ||
3996 | % \fi | ||
3997 | % | ||
3998 | % \label{ref:ekdverse-ex} | ||
3999 | % Finally, an extract of Silius Italicus' \emph{Punica}, Book~9, | ||
4000 | % ll.~30-2 follows (|.tex| source file, PDF output and \texttt{TEI} | ||
4001 | % output files):--- | ||
4002 | % | ||
4003 | % \iffalse | ||
4004 | %<*example> | ||
4005 | % \fi | ||
4006 | \begin{minted}{latex} | ||
4007 | % Preamble: | ||
4008 | \usepackage[teiexport=tidy]{ekdosis} | ||
4009 | |||
4010 | % Witnesses: | ||
4011 | \DeclareWitness{L}{L}{Laurentianus, plut, XXXVII, cod. 16}[ | ||
4012 | origDate=s. XV] | ||
4013 | % Other witnesses [...] | ||
4014 | |||
4015 | % Scholars: | ||
4016 | \DeclareScholar{Drak}{\emph{Drakenborch}} | ||
4017 | % Other scholars [...] | ||
4018 | |||
4019 | % basename of the .xml bibliographical database: | ||
4020 | \SetxmlBibResource{bibl} | ||
4021 | |||
4022 | % Document: | ||
4023 | \begin{ekdosis} | ||
4024 | \begin{ekdverse} | ||
4025 | Sed uos, quorum oculos atque ora humentia uidi,\\ | ||
4026 | uertere cum consul terga et remeare iuberet,\\ | ||
4027 | \app{ | ||
4028 | \lem[wit=Drak]{ne morem} | ||
4029 | \rdg[wit={L, F}]{me morem} | ||
4030 | \rdg[wit={O, V}]{memorem} | ||
4031 | } et pugnae signum exspectate petendae: | ||
4032 | \end{ekdverse} | ||
4033 | \end{ekdosis} | ||
4034 | \end{minted} | ||
4035 | % \iffalse | ||
4036 | %</example> | ||
4037 | % \fi | ||
4038 | % | ||
4039 | % \needspace{7\baselineskip} | ||
4040 | % PDF output:--- | ||
4041 | % \medskip | ||
4042 | % | ||
4043 | % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen] | ||
4044 | % \resetlinenumber[30]\rightlinenumbers | ||
4045 | % \setlength{\linenumbersep}{-1.5in} | ||
4046 | % \begin{specimen} | ||
4047 | % \begin{ekdverse} | ||
4048 | % Sed uos, quorum oculos atque ora humentia uidi,\\ | ||
4049 | % uertere cum consul terga et remeare iuberet,\\ | ||
4050 | % \app{ | ||
4051 | % \lem[wit=sDrak]{ne morem} | ||
4052 | % \rdg[wit={sL, sF}]{me morem} | ||
4053 | % \rdg[wit={sO, sV}]{memorem} | ||
4054 | % } et pugnae signum exspectate petendae: | ||
4055 | % \end{ekdverse} | ||
4056 | % \end{specimen} | ||
4057 | % \end{alignment} | ||
4058 | % | ||
4059 | % \texttt{TEI xml} output file produced by \pkg{ekdosis} (narrowed | ||
4060 | % down to the |<text>| element):--- | ||
4061 | % | ||
4062 | % \iffalse | ||
4063 | %<*example> | ||
4064 | % \fi | ||
4065 | \begin{minted}{xml} | ||
4066 | <text> | ||
4067 | <body> | ||
4068 | <lg> | ||
4069 | <l>Sed uos, quorum oculos atque ora humentia uidi,</l> | ||
4070 | <l>uertere cum consul terga et remeare iuberet,</l> | ||
4071 | <l> | ||
4072 | <app> | ||
4073 | <lem wit="#Drak">ne morem</lem> | ||
4074 | <rdg wit="#L #F">me morem</rdg> | ||
4075 | <rdg wit="#O #V">memorem</rdg> | ||
4076 | </app>et pugnae signum exspectate petendae:</l> | ||
4077 | </lg> | ||
4078 | </body> | ||
4079 | <back> | ||
4080 | <listBibl> | ||
4081 | <biblStruct type="book" xml:id="Drak"> | ||
4082 | <monogr> | ||
4083 | <title level="m">Punicorum libri septemdecim</title> | ||
4084 | <author> | ||
4085 | <forename>Tiberius Catius</forename> | ||
4086 | <surname>Silius Italicus</surname> | ||
4087 | </author> | ||
4088 | <editor> | ||
4089 | <forename>Arnold</forename> | ||
4090 | <surname>Drakenborch</surname> | ||
4091 | </editor> | ||
4092 | <imprint> | ||
4093 | <pubPlace>Utrecht</pubPlace> | ||
4094 | <publisher>Trajecti ad Rhenum</publisher> | ||
4095 | <date>1717</date> | ||
4096 | </imprint> | ||
4097 | </monogr> | ||
4098 | </biblStruct> | ||
4099 | </listBibl> | ||
4100 | </back> | ||
4101 | </text> | ||
4102 | \end{minted} | ||
4103 | % \iffalse | ||
4104 | %</example> | ||
4105 | % \fi | ||
4106 | % | ||
4107 | % \subsection{Citation Commands} | ||
4108 | % \label{sec:citation-cmds} | ||
4109 | % \pkg{ekdosis} can also convert into \texttt{TEI xml} references to | ||
4110 | % cited works. Depending on the optional arguments used in the | ||
4111 | % citation command, references will be converted into |<ptr>| or | ||
4112 | % |<ref>| elements with the appropriate ID supplied by means of the | ||
4113 | % |target| attribute. | ||
4114 | % | ||
4115 | % Of course, for this mechanism to work, Bib\TeX\ or Bib\LaTeX\ must | ||
4116 | % be used and connected to some |.bib| bibliographical database | ||
4117 | % file. Additionally, this |.bib| file must have been converted into a | ||
4118 | % \texttt{TEI xml} compliant file where all the Bib\hologo{(La)TeX} | ||
4119 | % entries that are used in the document are found within | ||
4120 | % |<biblStruct>| elements.\footnote{See above n.~\vref{fn:zotero} for | ||
4121 | % information on how to do this.} Finally, this |.xml| bibliographical | ||
4122 | % database must have been connected to the |.tex| source file by means | ||
4123 | % of \cs{SetxmlBibResource} described above in | ||
4124 | % \vref{sec:references-cited-works}. | ||
4125 | % | ||
4126 | % As an example, the following |sample.bib| file is used:--- | ||
4127 | % | ||
4128 | % \iffalse | ||
4129 | %<*example> | ||
4130 | % \fi | ||
4131 | \begin{minted}[linenos=false]{bibtex} | ||
4132 | @Book{ReynoldsWilson1991, | ||
4133 | author = {Reynolds, L. D. and Wilson, N. G}, | ||
4134 | title = {Scribes and Scholars}, | ||
4135 | year = {1991}, | ||
4136 | subtitle = {A Guide to the Translation of Greek and Latin | ||
4137 | Literature}, | ||
4138 | edition = {3}, | ||
4139 | publisher = {Clarendon Press}, | ||
4140 | location = {Oxford} | ||
4141 | } | ||
4142 | \end{minted} | ||
4143 | % \iffalse | ||
4144 | %</example> | ||
4145 | % \fi | ||
4146 | % | ||
4147 | % It has been converted into |sample.xml| as follows:--- | ||
4148 | % | ||
4149 | % \iffalse | ||
4150 | %<*example> | ||
4151 | % \fi | ||
4152 | \begin{minted}[linenos=false]{xml} | ||
4153 | <?xml version="1.0" encoding="UTF-8"?> | ||
4154 | <listBibl xmlns="http://www.tei-c.org/ns/1.0"> | ||
4155 | <biblStruct type="book" xml:id="ReynoldsWilson1991"> | ||
4156 | <monogr> | ||
4157 | <title level="m">Scribes and Scholars</title> | ||
4158 | <author> | ||
4159 | <forename>L. D.</forename> | ||
4160 | <surname>Reynolds</surname> | ||
4161 | </author> | ||
4162 | <author> | ||
4163 | <forename>N. G.</forename> | ||
4164 | <surname>Wilson</surname> | ||
4165 | </author> | ||
4166 | <edition>3</edition> | ||
4167 | <imprint> | ||
4168 | <pubPlace>Oxford</pubPlace> | ||
4169 | <publisher>Clarendon Press</publisher> | ||
4170 | <date>1991</date> | ||
4171 | </imprint> | ||
4172 | </monogr> | ||
4173 | </biblStruct> | ||
4174 | </listBibl> | ||
4175 | \end{minted} | ||
4176 | % \iffalse | ||
4177 | %</example> | ||
4178 | % \fi | ||
3249 | % | 4179 | % |
4180 | % Once both files have been prepared, inserting references and | ||
4181 | % exporting them into the \texttt{TEI xml} ouput file can be achieved | ||
4182 | % in a straightforward way. (The full |sample.tex| is provided | ||
4183 | % below.)--- | ||
4184 | % | ||
4185 | % \iffalse | ||
4186 | %<*example> | ||
4187 | % \fi | ||
4188 | \begin{minted}[linenos=false]{latex} | ||
4189 | \documentclass{article} | ||
4190 | |||
4191 | \usepackage[teiexport=tidy]{ekdosis} | ||
4192 | \SetxmlBibResource{sample} % base name supplied here, without the | ||
4193 | % extension | ||
4194 | |||
4195 | \usepackage[style=oxnotes]{biblatex} | ||
4196 | \addbibresource{sample.bib} | ||
4197 | |||
4198 | \begin{document} | ||
4199 | \begin{ekdosis} | ||
4200 | On textual criticism, see \cite[207--241]{ReynoldsWilson1991}. | ||
4201 | \end{ekdosis} | ||
4202 | \end{document} | ||
4203 | \end{minted} | ||
4204 | % \iffalse | ||
4205 | %</example> | ||
4206 | % \fi | ||
3250 | % | 4207 | % |
3251 | % \section{To Be Continued...} | 4208 | % PDF output:--- |
3252 | % v1.0 of \pkg{ekdosis}, which should be available by the end of July | 4209 | % \medskip |
3253 | % 2020, will include a full documentation. At the time of writing, the | ||
3254 | % author is working on this part of the package. | ||
3255 | % | 4210 | % |
4211 | % \resetlinenumber | ||
4212 | % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen] | ||
4213 | % \begin{specimen} | ||
4214 | % On textual criticism, see \cite[207--241]{ReynoldsWilson1991}. | ||
4215 | % \end{specimen} | ||
4216 | % \end{alignment} | ||
4217 | % | ||
4218 | % \medskip | ||
4219 | % \texttt{TEI xml} ouput narrowed down to the contents of the |<text>| | ||
4220 | % element:--- | ||
4221 | % | ||
4222 | % \iffalse | ||
4223 | %<*example> | ||
4224 | % \fi | ||
4225 | \begin{minted}[linenos=false]{xml} | ||
4226 | <text> | ||
4227 | <body> | ||
4228 | <p>On textual criticism, see | ||
4229 | <ref target="#ReynoldsWilson1991">207--241</ref>.</p> | ||
4230 | </body> | ||
4231 | <back> | ||
4232 | <listBibl> | ||
4233 | <biblStruct type="book" xml:id="ReynoldsWilson1991"> | ||
4234 | <monogr> | ||
4235 | <title level="m">Scribes and Scholars</title> | ||
4236 | <author> | ||
4237 | <forename>L. D.</forename> | ||
4238 | <surname>Reynolds</surname> | ||
4239 | </author> | ||
4240 | <author> | ||
4241 | <forename>N. G.</forename> | ||
4242 | <surname>Wilson</surname> | ||
4243 | </author> | ||
4244 | <edition>3</edition> | ||
4245 | <imprint> | ||
4246 | <pubPlace>Oxford</pubPlace> | ||
4247 | <publisher>Clarendon Press</publisher> | ||
4248 | <date>1991</date> | ||
4249 | </imprint> | ||
4250 | </monogr> | ||
4251 | </biblStruct> | ||
4252 | </listBibl> | ||
4253 | </back> | ||
4254 | </text> | ||
4255 | \end{minted} | ||
4256 | % \iffalse | ||
4257 | %</example> | ||
4258 | % \fi | ||
4259 | % | ||
4260 | % At the time of writing, the following citation commands are | ||
4261 | % converted into \texttt{TEI xml} by \pkg{ekdosis}:--- | ||
4262 | % \begin{enumerate} | ||
4263 | % \item | ||
4264 | % \cs{icite}\oarg{prenote}\oarg{postnote}\marg{key}\footnote{From the | ||
4265 | % \pkg{icite} package. \cs{icite} can be used in place of almost any | ||
4266 | % standard citation command. See \cite{icite}.} | ||
4267 | % \item \cs{cite}\oarg{prenote}\oarg{postnote}\marg{key} | ||
4268 | % \item \cs{Cite}\oarg{prenote}\oarg{postnote}\marg{key} | ||
4269 | % \item \cs{cite*}\oarg{prenote}\oarg{postnote}\marg{key} | ||
4270 | % \item \cs{parencite}\oarg{prenote}\oarg{postnote}\marg{key} | ||
4271 | % \item \cs{Parencite}\oarg{prenote}\oarg{postnote}\marg{key} | ||
4272 | % \item \cs{parencite*}\oarg{prenote}\oarg{postnote}\marg{key} | ||
4273 | % \item \cs{footcite}\oarg{prenote}\oarg{postnote}\marg{key} | ||
4274 | % \item \cs{footcitetext}\oarg{prenote}\oarg{postnote}\marg{key} | ||
4275 | % \item \cs{textcite}\oarg{prenote}\oarg{postnote}\marg{key} | ||
4276 | % \item \cs{Textcite}\oarg{prenote}\oarg{postnote}\marg{key} | ||
4277 | % \item \cs{smartcite}\oarg{prenote}\oarg{postnote}\marg{key} | ||
4278 | % \item \cs{Smartcite}\oarg{prenote}\oarg{postnote}\marg{key} | ||
4279 | % \item \cs{autocite}\oarg{prenote}\oarg{postnote}\marg{key} | ||
4280 | % \item \cs{Autocite}\oarg{prenote}\oarg{postnote}\marg{key} | ||
4281 | % \item \cs{autocite*}\oarg{prenote}\oarg{postnote}\marg{key} | ||
4282 | % \item \cs{Autocite*}\oarg{prenote}\oarg{postnote}\marg{key} | ||
4283 | % \end{enumerate} | ||
4284 | % | ||
4285 | % The next release of \pkg{ekdosis} will include all citation commands | ||
4286 | % with the exception of so-called \enquote{qualified citation lists}. | ||
4287 | % | ||
4288 | % \section{Future Work} | ||
4289 | % \label{sec:future-work} | ||
4290 | % A short, uncommented list of what is planned in the versions of | ||
4291 | % \pkg{ekdosis} to come follows:--- | ||
4292 | % \begin{enumerate} | ||
4293 | % \item Very short-term (weeks):--- | ||
4294 | % \begin{enumerate} | ||
4295 | % \item Editorial changes, for inserting corrections and | ||
4296 | % conjectures. | ||
4297 | % \item Text structure: milestone elements. | ||
4298 | % \end{enumerate} | ||
4299 | % \item Short-term (months):--- | ||
4300 | % \begin{enumerate} | ||
4301 | % \item Poetry: The standard \env{verse} environment is supported by | ||
4302 | % the current version of \pkg{ekdosis}, in addition to | ||
4303 | % \env{ekdverse} an example of which has been provided above | ||
4304 | % \vpageref{ref:ekdverse-ex}. \env{ekdverse} will provide refined | ||
4305 | % options, such as metrical analysis, stanzaic forms, \emph{\&c.} | ||
4306 | % Arabic poetry through the environments and commands provided by | ||
4307 | % the \pkg{arabluatex} package will also be supported. | ||
4308 | % \item Correspondence and alignment, segmentation: The functions | ||
4309 | % are being tested at the time of writing and will be included | ||
4310 | % shortly in \pkg{ekdosis}. | ||
4311 | % \end{enumerate} | ||
4312 | % \item Medium-term: Indexing, commands and environments for specific | ||
4313 | % modules of the \texttt{TEI}. | ||
4314 | % \end{enumerate} | ||
4315 | % | ||
3256 | % \begin{comment} | 4316 | % \begin{comment} |
3257 | % \section{Correspondence and Alignment} | 4317 | % \section{Correspondence and Alignment} |
3258 | % \end{comment} | 4318 | % \end{comment} |
@@ -4084,6 +5144,28 @@ subtype="arabtex">'inna 'abI kAna mina | |||
4084 | % \end{macrocode} | 5144 | % \end{macrocode} |
4085 | % \end{macro} | 5145 | % \end{macro} |
4086 | % \paragraph{\TeX\ to \texttt{TEI xml}} | 5146 | % \paragraph{\TeX\ to \texttt{TEI xml}} |
5147 | % Here follow the |key-value| options to be used by \cs{SetTEIxmlExport} | ||
5148 | % below:--- | ||
5149 | % \begin{macrocode} | ||
5150 | \ekvdefinekeys{tei@settings}{ | ||
5151 | choice autopar = {true = \luadirect{ekdosis.setteiautopar("yes")}, | ||
5152 | false = {\luadirect{ekdosis.setteiautopar("no")}}}, | ||
5153 | initial autopar = true, | ||
5154 | unknown-choice autopar = \PackageError{ekdosis}{unknown | ||
5155 | autopar=#1}{`autopar' must be either `true' or `false'.} | ||
5156 | } | ||
5157 | % \end{macrocode} | ||
5158 | % \begin{macro}{\SetTEIxmlExport} | ||
5159 | % \cs{SetTEIxmlExport} collects the settings to be applied | ||
5160 | % to \texttt{TEI xml} export. For now, there is only one option. This | ||
5161 | % command can be used at any point of the document, except inside | ||
5162 | % environments meant to receive an apparatus criticus. | ||
5163 | % \begin{macrocode} | ||
5164 | \NewDocumentCommand{\SetTEIxmlExport}{m}{ | ||
5165 | \unless\ifekd@state\ekvset{tei@settings}{#1}\fi | ||
5166 | } | ||
5167 | % \end{macrocode} | ||
5168 | % \end{macro} | ||
4087 | % The following three commands can be used to instruct \pkg{ekdosis} | 5169 | % The following three commands can be used to instruct \pkg{ekdosis} |
4088 | % how to convert unknown or unusual \hologo{(La)TeX} commands into | 5170 | % how to convert unknown or unusual \hologo{(La)TeX} commands into |
4089 | % \texttt{TEI xml} equivalents. | 5171 | % \texttt{TEI xml} equivalents. |
@@ -4154,8 +5236,8 @@ subtype="arabtex">'inna 'abI kAna mina | |||
4154 | % \begin{macro}{\SetxmlBibResource} This is a preamble-only command. | 5236 | % \begin{macro}{\SetxmlBibResource} This is a preamble-only command. |
4155 | % If a base name for a \texttt{TEI xml} compliant bibliographical | 5237 | % If a base name for a \texttt{TEI xml} compliant bibliographical |
4156 | % database file is provided with | 5238 | % database file is provided with |
4157 | % \cs{SetxmlBibResource}\marg{basename}, \pkg{ekdosis} will use | 5239 | % \cs{SetxmlBibResource}\marg{basename}, \pkg{ekdosis} will use it |
4158 | % insert formatted data in the back matter section of its own | 5240 | % and insert formatted data in the back matter section of its own |
4159 | % \texttt{TEI xml} output file, as |<biblStruct>| elements within a | 5241 | % \texttt{TEI xml} output file, as |<biblStruct>| elements within a |
4160 | % |<listBibl>| section. | 5242 | % |<listBibl>| section. |
4161 | % \begin{macrocode} | 5243 | % \begin{macrocode} |
@@ -5393,7 +6475,16 @@ subtype="arabtex">'inna 'abI kAna mina | |||
5393 | \item[] | 6475 | \item[] |
5394 | }{\end{list}} | 6476 | }{\end{list}} |
5395 | % \end{macrocode} | 6477 | % \end{macrocode} |
5396 | % | 6478 | % \begin{environment}{ekdpar} |
6479 | % When |autopar| is set to |false| by means of \cs{SetTEIxmlExport}, | ||
6480 | % \env{ekdpar}\---or any other environment set to be inserted within | ||
6481 | % |<p>| elements\---must be used so that \pkg{ekdosis} can be | ||
6482 | % informed of paragraph boundaries. | ||
6483 | % \begin{macrocode} | ||
6484 | \NewDocumentEnvironment{ekdpar}{}{\par}{\par} | ||
6485 | % \end{macrocode} | ||
6486 | % \end{environment} | ||
6487 | % | ||
5397 | % \iffalse | 6488 | % \iffalse |
5398 | %</package> | 6489 | %</package> |
5399 | % \fi | 6490 | % \fi |
@@ -5439,9 +6530,9 @@ local endpoem = lpeg.Cs(lnbrk * lpeg.S("*!") * bsqbrackets^-1) | |||
5439 | local sections = lpeg.Cs(lpeg.P("book") + lpeg.P("part") + lpeg.P("chapter") | 6530 | local sections = lpeg.Cs(lpeg.P("book") + lpeg.P("part") + lpeg.P("chapter") |
5440 | + lpeg.P("section") + lpeg.P("subsection") | 6531 | + lpeg.P("section") + lpeg.P("subsection") |
5441 | + lpeg.P("subsubsection")) | 6532 | + lpeg.P("subsubsection")) |
5442 | local par = lpeg.P(lpeg.P("\\par") * spce^1) | 6533 | local par = lpeg.P(lpeg.P("\\par") * spce^0) |
5443 | local parb = lpeg.P(lpeg.Cs("\\p@rb") * spce^1) | 6534 | local parb = lpeg.P(lpeg.Cs("\\p@rb") * spce^0) |
5444 | local para = lpeg.P(lpeg.Cs("\\p@ra") * spce^1) | 6535 | local para = lpeg.P(lpeg.Cs("\\p@ra") * spce^0) |
5445 | local labelrefcmds = lpeg.Cs(lpeg.P("label") | 6536 | local labelrefcmds = lpeg.Cs(lpeg.P("label") |
5446 | + lpeg.P("linelabel") | 6537 | + lpeg.P("linelabel") |
5447 | + lpeg.P("lineref") | 6538 | + lpeg.P("lineref") |
@@ -5449,7 +6540,25 @@ local labelrefcmds = lpeg.Cs(lpeg.P("label") | |||
5449 | + lpeg.P("pageref") | 6540 | + lpeg.P("pageref") |
5450 | + lpeg.P("vref") | 6541 | + lpeg.P("vref") |
5451 | + lpeg.P("vpageref")) | 6542 | + lpeg.P("vpageref")) |
5452 | 6543 | local citecmds = lpeg.Cs(lpeg.P("icite") | |
6544 | + lpeg.P("cite") | ||
6545 | + lpeg.P("Cite") | ||
6546 | + lpeg.P("cite *") | ||
6547 | + lpeg.P("parencite") | ||
6548 | + lpeg.P("Parencite") | ||
6549 | + lpeg.P("parencite *") | ||
6550 | + lpeg.P("footcite") | ||
6551 | + lpeg.P("footcitetext") | ||
6552 | + lpeg.P("textcite") | ||
6553 | + lpeg.P("Textcite") | ||
6554 | + lpeg.P("smartcite") | ||
6555 | + lpeg.P("Smartcite") | ||
6556 | + lpeg.P("autocite") | ||
6557 | + lpeg.P("Autocite") | ||
6558 | + lpeg.P("autocite *") | ||
6559 | + lpeg.P("Autocite *") | ||
6560 | ) | ||
6561 | -- | ||
5453 | -- Bind to local variables | 6562 | -- Bind to local variables |
5454 | local next = next | 6563 | local next = next |
5455 | 6564 | ||
@@ -5699,11 +6808,14 @@ local cmdtotags = { | |||
5699 | {a="textsf", b="hi", c=" rend=\"sf\""}, | 6808 | {a="textsf", b="hi", c=" rend=\"sf\""}, |
5700 | {a="arbup", b="hi", c=" rend=\"sup\""}, | 6809 | {a="arbup", b="hi", c=" rend=\"sup\""}, |
5701 | {a="txarb", b="s", c=" xml:lang=\"arb\""}, | 6810 | {a="txarb", b="s", c=" xml:lang=\"arb\""}, |
6811 | {a="mbox", b="", c=""}, | ||
5702 | {a="arb", b="foreign", | 6812 | {a="arb", b="foreign", |
5703 | c=" xml:lang=\"ar-Latn\" type=\"transliterated\" subtype=\"arabtex\""} | 6813 | c=" xml:lang=\"ar-Latn\" type=\"transliterated\" subtype=\"arabtex\""} |
5704 | } | 6814 | } |
5705 | 6815 | ||
5706 | local texpatttotags = { | 6816 | local texpatttotags = { |
6817 | {a="\\pagebreak%s+%[[1-4]%]", b=""}, | ||
6818 | {a="\\pagebreak%s+", b=""}, | ||
5707 | {a="\\altrfont%s+", b=""}, | 6819 | {a="\\altrfont%s+", b=""}, |
5708 | {a="\\LR%s+{(.-)}", b="%1"}, | 6820 | {a="\\LR%s+{(.-)}", b="%1"}, |
5709 | {a="\\RL%s+{(.-)}", b="%1"} | 6821 | {a="\\RL%s+{(.-)}", b="%1"} |
@@ -5716,6 +6828,7 @@ local envtotags = { | |||
5716 | {a="ekdverse", b="lg", c=""}, | 6828 | {a="ekdverse", b="lg", c=""}, |
5717 | {a="txarabtr", b="p", c=" xml:lang=\"ar-Latn\" type=\"transliterated\""}, | 6829 | {a="txarabtr", b="p", c=" xml:lang=\"ar-Latn\" type=\"transliterated\""}, |
5718 | {a="quoting", b="quote", c=""}, | 6830 | {a="quoting", b="quote", c=""}, |
6831 | {a="ekdpar", b="p", c=""}, | ||
5719 | {a="txarab", b="p", c=" xml:lang=\"arb\""}, | 6832 | {a="txarab", b="p", c=" xml:lang=\"arb\""}, |
5720 | {a="center", b="p", c=" rend=\"align(center)\""}, | 6833 | {a="center", b="p", c=" rend=\"align(center)\""}, |
5721 | {a="verse", b="lg", c=""}, | 6834 | {a="verse", b="lg", c=""}, |
@@ -5972,7 +7085,7 @@ end | |||
5972 | 7085 | ||
5973 | local function icitetotei(str) | 7086 | local function icitetotei(str) |
5974 | str = gsub(str, lpeg.P("\\") | 7087 | str = gsub(str, lpeg.P("\\") |
5975 | * lpeg.Cs("icite") | 7088 | * citecmds |
5976 | * spcenc^-1 | 7089 | * spcenc^-1 |
5977 | * bsqbrackets | 7090 | * bsqbrackets |
5978 | * bsqbrackets | 7091 | * bsqbrackets |
@@ -5994,7 +7107,7 @@ local function icitetotei(str) | |||
5994 | return string.format("%s <ref target=\"#%s\">%s</ref>", pre, body, post) | 7107 | return string.format("%s <ref target=\"#%s\">%s</ref>", pre, body, post) |
5995 | end) | 7108 | end) |
5996 | str = gsub(str, lpeg.P("\\") | 7109 | str = gsub(str, lpeg.P("\\") |
5997 | * lpeg.Cs("icite") | 7110 | * citecmds |
5998 | * spcenc^-1 | 7111 | * spcenc^-1 |
5999 | * bsqbrackets | 7112 | * bsqbrackets |
6000 | * bcbraces | 7113 | * bcbraces |
@@ -6014,7 +7127,7 @@ local function icitetotei(str) | |||
6014 | return string.format("<ref target=\"#%s\">%s</ref>", body, post) | 7127 | return string.format("<ref target=\"#%s\">%s</ref>", body, post) |
6015 | end) | 7128 | end) |
6016 | str = gsub(str, lpeg.P("\\") | 7129 | str = gsub(str, lpeg.P("\\") |
6017 | * lpeg.Cs("icite") | 7130 | * citecmds |
6018 | * spcenc^-1 | 7131 | * spcenc^-1 |
6019 | * bcbraces | 7132 | * bcbraces |
6020 | * bsqbrackets^-1, | 7133 | * bsqbrackets^-1, |
@@ -6104,19 +7217,36 @@ local function cmdtotei(str) | |||
6104 | return str | 7217 | return str |
6105 | end | 7218 | end |
6106 | 7219 | ||
7220 | local teiautopar = true | ||
7221 | |||
7222 | function ekdosis.setteiautopar(choice) | ||
7223 | if choice == "yes" | ||
7224 | then | ||
7225 | teiautopar = true | ||
7226 | else | ||
7227 | teiautopar = false | ||
7228 | end | ||
7229 | return true | ||
7230 | end | ||
7231 | |||
6107 | local function partotei(str) | 7232 | local function partotei(str) |
6108 | str = gsub(str, lpeg.P(lpeg.P("\\par") * spcenc^1)^1, "\\par ") | 7233 | if teiautopar |
6109 | str = gsub(str, ((para + parb) * par^-1)^2, "\\p@r ") | 7234 | then |
6110 | str = string.gsub(str, "\\p@ra%s+", "<p>") | 7235 | str = gsub(str, lpeg.P(lpeg.P("\\par") * spcenc^1)^1, "\\par ") |
6111 | str = string.gsub(str, "\\p@rb%s+", "</p>") | 7236 | str = gsub(str, ((para + parb) * par^-1)^2, "\\p@r ") |
6112 | str = string.gsub(str, "\\p@r%s+", "") | 7237 | str = string.gsub(str, "\\p@ra%s+", "<p>") |
6113 | str = string.gsub(str, "%s?\\par%s?", "<p>", 1) | 7238 | str = string.gsub(str, "\\p@rb%s+", "</p>") |
6114 | str = string.gsub(str, "(%<p%>)(%s-)(%<%/?div%d?)", "%3") | 7239 | str = string.gsub(str, "\\p@r%s+", "") |
6115 | str = string.gsub(str, "%s?\\par%s?", "</p><p>") | 7240 | str = string.gsub(str, "%s?\\par%s?", "<p>", 1) |
6116 | str = string.gsub(str, "<p>%s?</p>", "") | 7241 | str = string.gsub(str, "(%<p%>)(%s-)(%<%/?div%d?)", "%3") |
6117 | str = string.gsub(str, "(%<p%>)%s?(%</div%>)$", "%2") | 7242 | str = string.gsub(str, "%s?\\par%s?", "</p><p>") |
6118 | str = string.gsub(str, "(%<p%>)%s?$", "") | 7243 | str = string.gsub(str, "<p>%s?</p>", "") |
6119 | str = string.gsub(str, "(<p>)%s?(<div.->)", "%2%1") | 7244 | str = string.gsub(str, "(%<p%>)%s?(%</div%>)$", "%2") |
7245 | str = string.gsub(str, "(%<p%>)%s?$", "") | ||
7246 | str = string.gsub(str, "(<p>)%s?(<div.->)", "%2%1") | ||
7247 | else | ||
7248 | str = gsub(str, par + para + parb, "") | ||
7249 | end | ||
6120 | return str | 7250 | return str |
6121 | end | 7251 | end |
6122 | 7252 | ||
@@ -6768,31 +7898,6 @@ end | |||
6768 | 7898 | ||
6769 | local environment_div = {} | 7899 | local environment_div = {} |
6770 | 7900 | ||
6771 | function ekdosis.newscholar(id, siglum) | ||
6772 | if xmlidfound(id) | ||
6773 | then | ||
6774 | tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" | ||
6775 | ..id.. | ||
6776 | "\" already exists as an xml:id. " | ||
6777 | .. | ||
6778 | "Please pick another id.}}") | ||
6779 | elseif not checkxmlid(id) | ||
6780 | then | ||
6781 | tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" | ||
6782 | ..id.. | ||
6783 | "\" is not a valid xml:id. \\MessageBreak " | ||
6784 | .. | ||
6785 | "Please pick another id.}}") | ||
6786 | else | ||
6787 | table.insert(xmlids, {xmlid = id}) | ||
6788 | table.sort(xmlids, function(a ,b) return(#a.xmlid > #b.xmlid) end) | ||
6789 | table.insert(idsRend, {xmlid = id, abbr = siglum}) | ||
6790 | table.sort(idsRend, function(a ,b) return(#a.xmlid > #b.xmlid) end) | ||
6791 | end | ||
6792 | return true | ||
6793 | end | ||
6794 | |||
6795 | |||
6796 | local function build_envdiv(str) | 7901 | local function build_envdiv(str) |
6797 | if not environment_div[str] | 7902 | if not environment_div[str] |
6798 | then | 7903 | then |