diff options
-rw-r--r-- | ekdosis.dtx | 145 |
1 files changed, 107 insertions, 38 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx index c85aec8..bd829b0 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx | |||
@@ -331,7 +331,7 @@ along with this program. If not, see | |||
331 | \def\oasymbol{\faUnlock} | 331 | \def\oasymbol{\faUnlock} |
332 | \usepackage{biblatex-ext-oa} | 332 | \usepackage{biblatex-ext-oa} |
333 | } | 333 | } |
334 | {\usepackage[symbolpackage=l3draw]{biblatex-ext-oa}} | 334 | {\usepackage[symbolpackage=tikz]{biblatex-ext-oa}} |
335 | \DeclareDelimFormat[bib,biblist]{nametitledelim}{\addcomma\space} | 335 | \DeclareDelimFormat[bib,biblist]{nametitledelim}{\addcomma\space} |
336 | \DeclareDelimFormat[bib,biblist]{innametitledelim}{\addcomma\space} | 336 | \DeclareDelimFormat[bib,biblist]{innametitledelim}{\addcomma\space} |
337 | \renewcommand*\newunitpunct{\addcomma\space} | 337 | \renewcommand*\newunitpunct{\addcomma\space} |
@@ -2175,6 +2175,22 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ | |||
2175 | % \iffalse | 2175 | % \iffalse |
2176 | %</example> | 2176 | %</example> |
2177 | % \fi | 2177 | % \fi |
2178 | % | ||
2179 | % \paragraph{Limiting the Number of Entries per Page} | ||
2180 | % 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, | ||
2182 | % notably when entries are so abundant in number that \pkg{ekdosis} | ||
2183 | % may oscillate indefinitely between different sets of page decisions | ||
2184 | % without being able to settle down.\\ | ||
2185 | % \DescribeOption{maxentries} |maxentries|=\meta{n} (where $n \geq | ||
2186 | % 10$) \hfill\tcboxverb{Default: not set}\\ | ||
2187 | % If |maxentries|$=$\meta{n} be set, then \pkg{ekdosis} will issue | ||
2188 | % \cs{pagebreak} (namely \cs{penalty}|-10000|) just after the | ||
2189 | % \emph{n\textsuperscript{th}} entry has been inserted in the layer of | ||
2190 | % the apparatus criticus this option is related to. As a result, the | ||
2191 | % page will actually break at the end of the current line. The | ||
2192 | % particulars of this technique will be discussed below in | ||
2193 | % \vref{sec:tricks-of-trade}. | ||
2178 | % | 2194 | % |
2179 | % \section{Inserting Notes in Multiple-Layer Apparatus} | 2195 | % \section{Inserting Notes in Multiple-Layer Apparatus} |
2180 | % \label{sec:notes-in-multilayer-app} | 2196 | % \label{sec:notes-in-multilayer-app} |
@@ -2904,6 +2920,15 @@ subtype="arabtex">'inna 'abI kAna mina | |||
2904 | % must be set to |latex| explicitly\---viz. |divs=latex|\---as | 2920 | % must be set to |latex| explicitly\---viz. |divs=latex|\---as |
2905 | % described above \vpageref{ref:divs-opt}. | 2921 | % described above \vpageref{ref:divs-opt}. |
2906 | % | 2922 | % |
2923 | % \danger As the \env{alignment} environment that is provided by | ||
2924 | % \pkg{ekdosis} places all aligned texts within \texttt{TEI xml} | ||
2925 | % un-numbered |<div>| elements and \LaTeX\ textual divisions are | ||
2926 | % converted into numbered |<div|\textsubscript{\emph{n}}|>| elements, | ||
2927 | % inserting such divisions in texts to be aligned will result in an | ||
2928 | % invalid \texttt{TEI xml} output. Instead, un-numbered divisions | ||
2929 | % through \cs{ekddiv} must be used as described below in | ||
2930 | % \vref{sec:ekddiv}. | ||
2931 | % | ||
2907 | % Once |divs| has been set to |latex|, \pkg{ekdosis} converts | 2932 | % Once |divs| has been set to |latex|, \pkg{ekdosis} converts |
2908 | % \cs{book}, \cs{part}, \cs{chapter}, \cs{section}, \cs{subsection} | 2933 | % \cs{book}, \cs{part}, \cs{chapter}, \cs{section}, \cs{subsection} |
2909 | % and \cs{subsubsection} into corresponding \texttt{TEI} | 2934 | % and \cs{subsubsection} into corresponding \texttt{TEI} |
@@ -3082,6 +3107,7 @@ subtype="arabtex">'inna 'abI kAna mina | |||
3082 | %</example> | 3107 | %</example> |
3083 | % \fi | 3108 | % \fi |
3084 | % | 3109 | % |
3110 | % \needspace{5\baselineskip} | ||
3085 | % PDF output:--- | 3111 | % PDF output:--- |
3086 | % \medskip | 3112 | % \medskip |
3087 | % | 3113 | % |
@@ -3138,6 +3164,10 @@ subtype="arabtex">'inna 'abI kAna mina | |||
3138 | %</example> | 3164 | %</example> |
3139 | % \fi | 3165 | % \fi |
3140 | % | 3166 | % |
3167 | % \section{The Tricks of the Trade} | ||
3168 | % \label{sec:tricks-of-trade} | ||
3169 | % | ||
3170 | % | ||
3141 | % \section{\texttt{TEI xml} Output} | 3171 | % \section{\texttt{TEI xml} Output} |
3142 | % \label{sec:teixml-output} | 3172 | % \label{sec:teixml-output} |
3143 | % Several examples of \texttt{TEI xml} output have been provided | 3173 | % Several examples of \texttt{TEI xml} output have been provided |
@@ -3150,31 +3180,31 @@ subtype="arabtex">'inna 'abI kAna mina | |||
3150 | % \texttt{TEI xml} (l.~11), the preamble of this file shows how to set | 3180 | % \texttt{TEI xml} (l.~11), the preamble of this file shows how to set |
3151 | % languages and fonts to be used in the document (ll.~2--6), format | 3181 | % languages and fonts to be used in the document (ll.~2--6), format |
3152 | % the titles (l.~16) and lay out the alignment of an edition text | 3182 | % the titles (l.~16) and lay out the alignment of an edition text |
3153 | % associated with two translations (ll.~18--25). Furthermore, it shows | 3183 | % associated with two translations (ll.~18--25) in modern |
3154 | % how information related to each language (Latin, English and French) | 3184 | % languages. Furthermore, it shows how information related to each |
3155 | % is to be found in two different places, namely for \texttt{TEI xml} | 3185 | % language (Latin, English and French) is to be found in two different |
3156 | % output (ll.~21--3) and for PDF output through \LaTeX\ | 3186 | % places, namely for \texttt{TEI xml} output (ll.~21--3) and for PDF |
3157 | % (ll.~27--9). Finally, it provides examples of declaring witnesses, | 3187 | % output through \LaTeX\ (ll.~27--9). Finally, it provides examples of |
3158 | % hands, scholars and shorthands (ll.~31--60). As to the document | 3188 | % declaring witnesses, hands, scholars and shorthands (ll.~31--60). As |
3159 | % itself, it shows how to lay out a conspectus siglorum in a table | 3189 | % to the document itself, it shows how to lay out a conspectus |
3160 | % (ll.~64--80), before giving detailed examples of how the edition | 3190 | % siglorum in a table (ll.~64--80), before giving detailed examples of |
3161 | % text is entered (ll~85--101) and sectional commands provided by | 3191 | % how the edition text is entered (ll.~85--101) and sectional commands |
3162 | % \pkg{ekdosis} are used (ll.~86, 103 and 110).\footnote{The PDF | 3192 | % provided by \pkg{ekdosis} are used (ll.~86, 103 and |
3163 | % output is available as \href{samples/Caesar_BG-6-13-1.pdf}{a | 3193 | % 110).\footnote{The PDF output is available as |
3164 | % separate file}.} | 3194 | % \href{samples/Caesar_BG-6-13-1.pdf}{a separate file}.} |
3165 | % | 3195 | % |
3166 | % \subsection{Requesting \texttt{TEI xml} Output} | 3196 | % \subsection{Requesting \texttt{TEI xml} Output} |
3167 | % \label{sec:request-tei-output} | 3197 | % \label{sec:request-tei-output} |
3168 | % \texttt{TEI xml} output is requested by means of the |teiexport| | 3198 | % \texttt{TEI xml} output is requested by means of the |teiexport| |
3169 | % global option as described above | 3199 | % global option as described above |
3170 | % \vpageref{ref:teiexport-option}. Once instructed to output | 3200 | % \vpageref{ref:teiexport-option}. Once instructed to output |
3171 | % \texttt{TEI}, \pkg{ekdosis} converts in sequence the contents of | 3201 | % \texttt{TEI}, \pkg{ekdosis} converts and exports in sequence the |
3172 | % \env{ekdosis} environments (see above | 3202 | % contents of \env{ekdosis} environments (see above |
3173 | % \vref{sec:single-text-editing}). As regards the contents of | 3203 | % \vref{sec:single-text-editing}). As regards the contents of |
3174 | % \env{alignment} environments (see above \vref{sec:alignment-basic}), | 3204 | % \env{alignment} environments (see above \vref{sec:alignment-basic}), |
3175 | % \pkg{ekdosis} first collates the contents of the environments that | 3205 | % \pkg{ekdosis} first collates the contents of the environments that |
3176 | % have been declared with the |texts| optional argument of | 3206 | % have been declared as values of the |texts| optional argument of |
3177 | % \env{alignment} or with \cs{SetAlignment},\footnote{See above | 3207 | % \env{alignment} or \cs{SetAlignment},\footnote{See above |
3178 | % \vref{sec:multiple-alignment}.} then places each of the | 3208 | % \vref{sec:multiple-alignment}.} then places each of the |
3179 | % corresponding \texttt{TEI xml} outputs within distinct |<div>| | 3209 | % corresponding \texttt{TEI xml} outputs within distinct |<div>| |
3180 | % elements named after the declared environments themselves. For | 3210 | % elements named after the declared environments themselves. For |
@@ -3183,10 +3213,17 @@ subtype="arabtex">'inna 'abI kAna mina | |||
3183 | % (see the |.tex| source file, \vref{sec:caesar-gw-tex}, ll.~85--101) | 3213 | % (see the |.tex| source file, \vref{sec:caesar-gw-tex}, ll.~85--101) |
3184 | % which is declared at l.~21. Then, the corresponding \texttt{xml} | 3214 | % which is declared at l.~21. Then, the corresponding \texttt{xml} |
3185 | % output is found within a |<div>| element, the |xml:id| of which has | 3215 | % output is found within a |<div>| element, the |xml:id| of which has |
3186 | % been called by \pkg{ekdosis} |div-latin_1| (see | 3216 | % been given by \pkg{ekdosis} the value |div-latin_1| (see |
3187 | % \vref{sec:caesar-gw-tei}, ll.~176--200). | 3217 | % \vref{sec:caesar-gw-tei}, ll.~176--200). |
3188 | % | 3218 | % |
3219 | % \paragraph{\texttt{TEI} File Name} \DescribeMacro{\SetTEIFilename} | ||
3220 | % \cs{SetTEIFilename}\marg{basename} is a preamble-only command. It | ||
3221 | % can be used to set the base name of the \texttt{TEI xml} output | ||
3222 | % file, to which the suffix |.xml| is appended. By default, the base | ||
3223 | % name is \cs{jobname}|-tei|. | ||
3189 | % | 3224 | % |
3225 | % \subsection{General Principles} | ||
3226 | % \label{sec:totei-general-principles} | ||
3190 | % \paragraph{Validation of the \texttt{TEI xml} Structure} | 3227 | % \paragraph{Validation of the \texttt{TEI xml} Structure} |
3191 | % The reference tool that the author relies on is that provided by the | 3228 | % The reference tool that the author relies on is that provided by the |
3192 | % \emph{\texttt{TEI} by Example Project}.\footnote{\cite{TBE}. | 3229 | % \emph{\texttt{TEI} by Example Project}.\footnote{\cite{TBE}. |
@@ -3197,14 +3234,13 @@ subtype="arabtex">'inna 'abI kAna mina | |||
3197 | % said, one must keep in mind that the \LaTeX\ packages that are part | 3234 | % said, one must keep in mind that the \LaTeX\ packages that are part |
3198 | % of {\TeX}Live can be counted in thousands, and the commands they | 3235 | % of {\TeX}Live can be counted in thousands, and the commands they |
3199 | % provide in tens of thousands. There may even be grounds in asserting | 3236 | % provide in tens of thousands. There may even be grounds in asserting |
3200 | % that the possibilities offered by \TeX\ and \LaTeX\ exceed what can | 3237 | % that the possibilities offered by \TeX\ and \LaTeX\ quite exceed |
3201 | % be afforded by \texttt{TEI xml}. On another hand, many \LaTeX\ | 3238 | % what can be afforded by \texttt{TEI xml}. On another hand, many |
3202 | % commands make no sense in \texttt{TEI}. Therefore, a sensible choice | 3239 | % \LaTeX\ commands make no sense in \texttt{TEI}. Therefore, a |
3203 | % is to keep them out of the environments the contents of which are to | 3240 | % sensible choice is to keep them out of the environments the contents |
3204 | % be translated into \texttt{xml} elements. | 3241 | % of which are to be translated into \texttt{xml} elements, as will be |
3205 | % | 3242 | % illustrated by the following. |
3206 | % \subsection{General Principles} | 3243 | % |
3207 | % \label{sec:totei-general-principles} | ||
3208 | % Converting a \LaTeX\ document into \texttt{TEI xml} is quite an | 3244 | % Converting a \LaTeX\ document into \texttt{TEI xml} is quite an |
3209 | % intricate business. In many cases, \LaTeX\ strings are found within | 3245 | % intricate business. In many cases, \LaTeX\ strings are found within |
3210 | % environments or groups: whether such groups are delimited by opening | 3246 | % environments or groups: whether such groups are delimited by opening |
@@ -4149,6 +4185,7 @@ subtype="arabtex">'inna 'abI kAna mina | |||
4149 | store sep = \sep@val, | 4185 | store sep = \sep@val, |
4150 | store bhook = \bhook@val, | 4186 | store bhook = \bhook@val, |
4151 | store ehook = \ehook@val, | 4187 | store ehook = \ehook@val, |
4188 | store maxentries = \limit@val, | ||
4152 | initial direction = LR, | 4189 | initial direction = LR, |
4153 | initial delim = {}, | 4190 | initial delim = {}, |
4154 | initial ehook = {\csname ekd@end@apparatus\endcsname} | 4191 | initial ehook = {\csname ekd@end@apparatus\endcsname} |
@@ -4158,11 +4195,13 @@ subtype="arabtex">'inna 'abI kAna mina | |||
4158 | % \cs{DeclareApparatus}\marg{apparatus name}\oarg{options} is a | 4195 | % \cs{DeclareApparatus}\marg{apparatus name}\oarg{options} is a |
4159 | % preamble-only command. As a mandatory argument, it takes the name of | 4196 | % preamble-only command. As a mandatory argument, it takes the name of |
4160 | % the new layer of notes to be inserted in the apparatus block. Then, | 4197 | % the new layer of notes to be inserted in the apparatus block. Then, |
4161 | % the following six key-value options can be used to lay out the | 4198 | % the following seven key-value options can be used to lay out the |
4162 | % layer: \verb+direction=LR|RL+, |rule|, |delim| (the delimiter between | 4199 | % layer: \verb+direction=LR|RL+, |rule|, |delim| (the delimiter between |
4163 | % entries), |sep| (the separator between lemma part and readings or | 4200 | % entries), |sep| (the separator between lemma part and readings or |
4164 | % notes), |bhook| (\LaTeX{} code inserted as the layer begins), | 4201 | % notes), |bhook| (\LaTeX{} code inserted as the layer begins), |
4165 | % |ehook| (\LaTeX{} code inserted as the layer ends):--- | 4202 | % |ehook| (\LaTeX{} code inserted as the layer ends), |maxentries| |
4203 | % (if set and |maxentries >= 10|, the number of entries at which a | ||
4204 | % \cs{pagebreak} is issued):--- | ||
4166 | % \begin{macrocode} | 4205 | % \begin{macrocode} |
4167 | \NewDocumentCommand{\DeclareApparatus}{m O{}}{ | 4206 | \NewDocumentCommand{\DeclareApparatus}{m O{}}{ |
4168 | \newbool{subsq@unit@#1} | 4207 | \newbool{subsq@unit@#1} |
@@ -4177,7 +4216,8 @@ subtype="arabtex">'inna 'abI kAna mina | |||
4177 | \luastringO{\delim@val}, | 4216 | \luastringO{\delim@val}, |
4178 | \luastringO{\sep@val}, | 4217 | \luastringO{\sep@val}, |
4179 | \luastringO{\bhook@val}, | 4218 | \luastringO{\bhook@val}, |
4180 | \luastringO{\ehook@val} | 4219 | \luastringO{\ehook@val}, |
4220 | \luastringO{\limit@val} | ||
4181 | )} | 4221 | )} |
4182 | \egroup | 4222 | \egroup |
4183 | } | 4223 | } |
@@ -4726,6 +4766,7 @@ subtype="arabtex">'inna 'abI kAna mina | |||
4726 | \luadirect{ekdosis.increment_bagunits(\luastringO{\ekdan@type})}% | 4766 | \luadirect{ekdosis.increment_bagunits(\luastringO{\ekdan@type})}% |
4727 | \def\ekd@munit@delim{% | 4767 | \def\ekd@munit@delim{% |
4728 | \luadirect{tex.sprint(ekdosis.getappdelim(\luastringO{\ekdan@type}))}}% | 4768 | \luadirect{tex.sprint(ekdosis.getappdelim(\luastringO{\ekdan@type}))}}% |
4769 | \luadirect{tex.sprint(ekdosis.limit_bagunits(\luastringO{\ekdan@type}))}% | ||
4729 | \fi% | 4770 | \fi% |
4730 | \ifekdl@nolem\edef\lem@app{% | 4771 | \ifekdl@nolem\edef\lem@app{% |
4731 | % \hskip .75em | 4772 | % \hskip .75em |
@@ -4934,6 +4975,7 @@ subtype="arabtex">'inna 'abI kAna mina | |||
4934 | \luadirect{ekdosis.increment_bagunits(\luastringO{\ekdan@type})}% | 4975 | \luadirect{ekdosis.increment_bagunits(\luastringO{\ekdan@type})}% |
4935 | \def\ekd@munit@delim{% | 4976 | \def\ekd@munit@delim{% |
4936 | \luadirect{tex.sprint(ekdosis.getappdelim(\luastringO{\ekdan@type}))}}% | 4977 | \luadirect{tex.sprint(ekdosis.getappdelim(\luastringO{\ekdan@type}))}}% |
4978 | \luadirect{tex.sprint(ekdosis.limit_bagunits(\luastringO{\ekdan@type}))}% | ||
4937 | \fi% | 4979 | \fi% |
4938 | \ifdefined\ekdn@labelb% | 4980 | \ifdefined\ekdn@labelb% |
4939 | \luadirect{tex.sprint(ekdosis.setnotelab(\luastringO{\ekdn@labelb}))}% | 4981 | \luadirect{tex.sprint(ekdosis.setnotelab(\luastringO{\ekdn@labelb}))}% |
@@ -5663,13 +5705,6 @@ local cmdtotags = { | |||
5663 | 5705 | ||
5664 | local texpatttotags = { | 5706 | local texpatttotags = { |
5665 | {a="\\altrfont%s+", b=""}, | 5707 | {a="\\altrfont%s+", b=""}, |
5666 | -- {a="\\icite%s?%[(.-)%]%[(.-)%]{(.-)}", b="%1 <ref target=\"#%3\">%2</ref>"}, | ||
5667 | -- {a="\\icite%s?%[(.-)%]{(.-)}", b="<ref target=\"#%2\">%1</ref>"}, | ||
5668 | -- {a="\\icite%s?{(.-)}", b="<ptr target=\"#%1\"/>"}, | ||
5669 | -- {a="\\linelabel%s?{(.-)}", b="<anchor xml:id=\"%1\"/>"}, | ||
5670 | -- {a="\\label%s?{(.-)}", b="<anchor xml:id=\"%1\"/>"}, | ||
5671 | -- {a="\\v?pageref%s?{(.-)}", b="<ptr target=\"#%1\"/>"}, | ||
5672 | -- {a="\\v?ref%s?{(.-)}", b="<ptr target=\"#%1\"/>"}, | ||
5673 | {a="\\LR%s+{(.-)}", b="%1"}, | 5708 | {a="\\LR%s+{(.-)}", b="%1"}, |
5674 | {a="\\RL%s+{(.-)}", b="%1"} | 5709 | {a="\\RL%s+{(.-)}", b="%1"} |
5675 | } | 5710 | } |
@@ -6879,7 +6914,8 @@ function ekdosis.newapparatus(teitype, | |||
6879 | appdelim, | 6914 | appdelim, |
6880 | appsep, | 6915 | appsep, |
6881 | appbhook, | 6916 | appbhook, |
6882 | appehook) | 6917 | appehook, |
6918 | applimit) | ||
6883 | if isintable(apparatuses, teitype) | 6919 | if isintable(apparatuses, teitype) |
6884 | then | 6920 | then |
6885 | tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" | 6921 | tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" |
@@ -6892,7 +6928,8 @@ function ekdosis.newapparatus(teitype, | |||
6892 | delim = appdelim, | 6928 | delim = appdelim, |
6893 | sep = appsep, | 6929 | sep = appsep, |
6894 | bhook = appbhook, | 6930 | bhook = appbhook, |
6895 | ehook = appehook}) | 6931 | ehook = appehook, |
6932 | limit = applimit}) | ||
6896 | end | 6933 | end |
6897 | bagunits[teitype] = 1 | 6934 | bagunits[teitype] = 1 |
6898 | return true | 6935 | return true |
@@ -6913,6 +6950,38 @@ function ekdosis.get_bagunits(teitype) | |||
6913 | return bagunits[teitype] | 6950 | return bagunits[teitype] |
6914 | end | 6951 | end |
6915 | 6952 | ||
6953 | local function getapplimit(str) | ||
6954 | for i = 1,#apparatuses | ||
6955 | do | ||
6956 | if apparatuses[i].a == str then | ||
6957 | limitfound = apparatuses[i].limit | ||
6958 | break | ||
6959 | end | ||
6960 | end | ||
6961 | if tonumber(limitfound) ~= nil | ||
6962 | then | ||
6963 | if tonumber(limitfound) < 10 | ||
6964 | then | ||
6965 | return 0 | ||
6966 | else | ||
6967 | return limitfound | ||
6968 | end | ||
6969 | else | ||
6970 | return 0 | ||
6971 | end | ||
6972 | end | ||
6973 | |||
6974 | function ekdosis.limit_bagunits(teitype) | ||
6975 | local limit = tonumber(getapplimit(teitype)) | ||
6976 | if limit >= 10 and bagunits[teitype] > limit | ||
6977 | then | ||
6978 | bagunits[teitype] = 2 | ||
6979 | return "\\pagebreak" | ||
6980 | else | ||
6981 | return "" | ||
6982 | end | ||
6983 | end | ||
6984 | |||
6916 | function ekdosis.increment_bagunits(teitype) | 6985 | function ekdosis.increment_bagunits(teitype) |
6917 | bagunits[teitype] = (bagunits[teitype] or 0) + 1 | 6986 | bagunits[teitype] = (bagunits[teitype] or 0) + 1 |
6918 | end | 6987 | end |