aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ekdosis.dtx306
-rw-r--r--samples/Caesar_BG-6-13-1.tex2
-rw-r--r--samples/Makefile3
3 files changed, 292 insertions, 19 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx
index 63ac19d..a1acf5b 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -225,6 +225,11 @@ along with this program. If not, see
225 origDate={s. XI--XII}] 225 origDate={s. XI--XII}]
226\DeclareShorthand{ca}{α}{cA,cM,cB,cR,cS,cL,cN} 226\DeclareShorthand{ca}{α}{cA,cM,cB,cR,cS,cL,cN}
227\DeclareShorthand{cb}{β}{cT,cf,cU,cl} 227\DeclareShorthand{cb}{β}{cT,cf,cU,cl}
228% Hippocrates Epidemics, Book 2:
229\DeclareWitness{hV}{V}{\emph{Vaticanus Gr.} 276}
230\DeclareWitness{hI}{I}{\emph{Parisinus Gr.} 2140}
231\DeclareWitness{hR}{R}{\emph{Vaticanus Gr.} 277}
232\DeclareWitness{hH}{H}{\emph{Parisinus Gr.} 2142}
228\end{filecontents} 233\end{filecontents}
229\documentclass{ltxdoc} 234\documentclass{ltxdoc}
230 %\usepackage[letterpaper,margin=25mm,left=50mm,nohead]{geometry} 235 %\usepackage[letterpaper,margin=25mm,left=50mm,nohead]{geometry}
@@ -849,7 +854,8 @@ along with this program. If not, see
849% traditions. \pkg{ekdosis} provides a flexible mechanism in which 854% traditions. \pkg{ekdosis} provides a flexible mechanism in which
850% format and presentation have been carefully separated from 855% format and presentation have been carefully separated from
851% content. It is designed to build un-numbered \texttt{TEI} divisions 856% content. It is designed to build un-numbered \texttt{TEI} divisions
852% allowed to nest recursively. However, if |divs| be set to |latex|, 857% allowed to nest recursively.\footnote{See below,
858% \vref{sec:body-divisions}.} However, if |divs| be set to |latex|,
853% \LaTeX{} standard textual divisions can be used and will be 859% \LaTeX{} standard textual divisions can be used and will be
854% translated into \texttt{TEI} numbered |<div>| elements. 860% translated into \texttt{TEI} numbered |<div>| elements.
855% 861%
@@ -1622,7 +1628,7 @@ yesterday.
1622% \fi 1628% \fi
1623% 1629%
1624% \resetlinenumber 1630% \resetlinenumber
1625% \ekdfmtdiv{2}{}{.} 1631% \EkdosisFormatDivision{2}{}{.}
1626% \begin{alignment}[flush,lcols=2, 1632% \begin{alignment}[flush,lcols=2,
1627% texts=edition[xml:lang="la"]; 1633% texts=edition[xml:lang="la"];
1628% translation[xml:lang="en"]] 1634% translation[xml:lang="en"]]
@@ -2452,7 +2458,7 @@ argument of the
2452% numbering.\footcite{lineno} But it must be noted that \pkg{ekdosis} 2458% numbering.\footcite{lineno} But it must be noted that \pkg{ekdosis}
2453% strictly prohibits the \enquote{pagewise} mode of operation that is 2459% strictly prohibits the \enquote{pagewise} mode of operation that is
2454% provided by \pkg{lineno}. As a result of this hinderance, all 2460% provided by \pkg{lineno}. As a result of this hinderance, all
2455% \enquote{margin switching} features of \pkg{lineno} are disabled 2461% \enquote{margin switching} functions of \pkg{lineno} are disabled
2456% within the environments that are specific to \pkg{ekdosis}, 2462% within the environments that are specific to \pkg{ekdosis},
2457% viz. \env{ekdosis} and \env{alignment}. 2463% viz. \env{ekdosis} and \env{alignment}.
2458% 2464%
@@ -2753,7 +2759,7 @@ argument of the
2753% produce a duplicate of the original |.tex| source file in which all 2759% produce a duplicate of the original |.tex| source file in which all
2754% |arabtex| or |buckwalter| strings are replaced with Unicode 2760% |arabtex| or |buckwalter| strings are replaced with Unicode
2755% equivalents, either in Arabic script or in any accepted standard of 2761% equivalents, either in Arabic script or in any accepted standard of
2756% transliteration.\footcite[See][\mkbibquote{Exporting Unicode Arabic 2762% transliteration.\footcite[\mkbibquote{Exporting Unicode Arabic
2757% to an External File}]{arabluatex} 2763% to an External File}]{arabluatex}
2758% 2764%
2759% \pkg{arabluatex} is fully supported by \pkg{ekdosis}. The following 2765% \pkg{arabluatex} is fully supported by \pkg{ekdosis}. The following
@@ -2829,7 +2835,7 @@ subtype="arabtex">'inna 'abI kAna mina
2829% which all |arabtex| strings found within \cs{begin}|{arabexport}| 2835% which all |arabtex| strings found within \cs{begin}|{arabexport}|
2830% \dots\ \cs{end}|{arabexport}| (see \vref{lst:arabluatex-ekd}, 2836% \dots\ \cs{end}|{arabexport}| (see \vref{lst:arabluatex-ekd},
2831% ll.~9--19) are replaced with full-vocalized Arabic Unicode 2837% ll.~9--19) are replaced with full-vocalized Arabic Unicode
2832% strings. Finally, compiling this latter file produces the following 2838% script. Finally, compiling this latter file produces the following
2833% |sample-arabic_out-tei.xml| an extract of which follows:--- 2839% |sample-arabic_out-tei.xml| an extract of which follows:---
2834% 2840%
2835% \iffalse 2841% \iffalse
@@ -2850,8 +2856,274 @@ subtype="arabtex">'inna 'abI kAna mina
2850% The reader will find the full |arabic-sample.tex| source file with 2856% The reader will find the full |arabic-sample.tex| source file with
2851% instructions in \vref{sec:arabic-sample}, and is invited to refer to 2857% instructions in \vref{sec:arabic-sample}, and is invited to refer to
2852% the documentation of the \pkg{arabluatex} package for more 2858% the documentation of the \pkg{arabluatex} package for more
2853% information on the way to use its Arabic environments and exporting 2859% information on the way to use its Arabic environments and built-in
2854% features.\footcite{arabluatex} 2860% functions dedicated to export |arabtex| ASCII strings to
2861% Unicode.\footcite{arabluatex}
2862%
2863% \section{Divisions of the Body}
2864% \label{sec:body-divisions}
2865% The features that are described in this section call for one general
2866% remark. \pkg{ekdosis} is designed to figure out where any \LaTeX\
2867% command that is converted to a \texttt{TEI} opening element allowed
2868% to nest recursively, such as |<div>|, |<lg>| and the like, is to be
2869% closed, even though there is no explicit indication of the point
2870% where the closure occurs. Thoroughly scanning \LaTeX\ source files
2871% with \textsf{Lua} functions which involve complex string matching
2872% and recursions was required, as \LaTeX\ \enquote*{open} commands
2873% such as \cs{chapter} or \cs{section} only act as milestones,
2874% contrary to \texttt{TEI} elements.
2875%
2876% \danger It must be noted that the two styles described hereinafter
2877% are mutually exclusive. \texttt{TEI xml} forbids that both be
2878% combined within a single |<body>| element.\footnote{See
2879% \url{https://tei-c.org/release/doc/tei-p5-doc/en/html/DS.html\#DSDIV}.}
2880% As a result, \pkg{ekdosis} will disregard whichever one is not
2881% selected.
2882% \vskip\baselineskip
2883%
2884% \subsection{\LaTeX\ Standard Divisions}
2885% \label{sec:latex-divs}
2886% \pkg{ekdosis} can use the \LaTeX\ standard textual divisions, such
2887% as \cs{book}, \cs{chapter}, \cs{section} and the like.
2888%
2889% \danger However, to have these divisions properly translated into
2890% \texttt{TEI} numbered |<div>| elements, the |divs| general option
2891% must be set to |latex| explicitly\---viz. |divs=latex|\---as
2892% described above \vpageref{ref:divs-opt}.
2893%
2894% Once |divs| has been set to |latex|, \pkg{ekdosis} converts
2895% \cs{book}, \cs{part}, \cs{chapter}, \cs{section}, \cs{subsection}
2896% and \cs{subsubsection} into corresponding \texttt{TEI}
2897% \enquote*{numbered} |<div|\textsubscript{\emph{n}}|>| elements,
2898% where $1\leq n\leq 6$.
2899%
2900% \paragraph{Adjusting the Levels of Textual Subdivisions}
2901% \DescribeMacro{\MkBodyDivs}
2902% \cs{MkBodyDivs}\marg{div1}\marg{div2}\marg{div3}\allowbreak\marg{div4}\marg{div5}\marg{div6}
2903% takes six mandatory arguments. This command can be used in the
2904% preamble or at any point of the document to make the number of the
2905% first-level subdivision of the edition text, viz.\ |<div1>|, match
2906% to any \LaTeX\ command other than \cs{book}. For example, if
2907% \cs{section} be the highest-level sectional command used, then
2908% \cs{MkBodyDivs}|{section}{subsection}{subsubsection}{}{}|\allowbreak|{}|
2909% will have \cs{section}, \cs{subsection} and \cs{subsubsection}
2910% converted into |<div1>|, |<div2>| and |<div3>| respectively.
2911%
2912% \paragraph{Inserting Variants in Headings}
2913% Variant readings can be inserted in headings. In this case, the
2914% optional argument of the \LaTeX\ sectional command must naturally be
2915% used to prevent variants from going into headers, footers or the
2916% table of contents, like so:---
2917%
2918% \iffalse
2919%<*example>
2920% \fi
2921\begin{minted}[linenos=false]{latex}
2922% Preamble:
2923\usepackage[teiexport=tidy, divs=latex]{ekdosis}
2924\MkBodyDivs{chapter}{section}{}{}{}{}
2925
2926% Document:
2927\chapter[Ἱπποκράτους ἐπιδημιῶν βιβλίον δεύτερον]{Ἱπποκράτους ἐπιδημιῶν
2928 \app{
2929 \lem[wit={I,R,H}]{βιβλίον δεύτερον}
2930 \rdg[wit=V]{λόγος β’}}}
2931
2932\section{<Τμῆμα πρῶτον>}
2933Ἄνθρακες θερινοὶ ἐν Κραννῶνι· [...]
2934\end{minted}
2935% \iffalse
2936%</example>
2937% \fi
2938%
2939% \texttt{TEI xml} output:---
2940%
2941% \iffalse
2942%<*example>
2943% \fi
2944\begin{minted}[linenos=false]{xml}
2945<div1 type="chapter">
2946 <head>Ἱπποκράτους ἐπιδημιῶν
2947 <app>
2948 <lem wit="#I #R #H">βιβλίον δεύτερον</lem>
2949 <rdg wit="#V">λόγος β’</rdg>
2950 </app></head>
2951 <div2 type="section">
2952 <head>&lt;Τμῆμα πρῶτον&gt;</head>
2953 <p>Ἄνθρακες θερινοὶ ἐν Κραννῶνι· [...]</p>
2954 </div2>
2955</div1>
2956\end{minted}
2957% \iffalse
2958%</example>
2959% \fi
2960%
2961% \subsection{Using \texttt{TEI} Un-numbered Divisions}
2962% \label{sec:ekddiv}
2963% \danger As already described \vpageref{ref:divs-opt}, the
2964% un-numbered style of division is the one that is set by default. It
2965% is congruous to the general option |divs=ekdosis|.
2966%
2967% This style provides a flexible mechanism in which format and
2968% presentation are separated from content. It is designed to meet the
2969% requirements of classical and literary texts the divisions of which
2970% may depend on many different received traditions.
2971%
2972% \DescribeMacro{\ekddiv} \cs{ekddiv}\marg{key-value arguments} is the
2973% unique sectional command provided by \pkg{ekdosis}. This command
2974% converts the divisions into un-numbered \texttt{TEI} |<div>|
2975% elements allowed to nest recursively and takes one mandatory
2976% argument in which the following |key-value| arguments are
2977% accepted:---\\
2978% \DescribeOption{type} |type|$=$\meta{name}
2979% \hfill\tcboxverb{Default: none}\\
2980% |type| corresponds to the \texttt{TEI} class |att.typed| and can be
2981% used to classify the element in which it is found in any
2982% way. Suitable values here can be |book|, |chapter|, |section| and
2983% the like.\\
2984% \DescribeOption{n} |n|$=$\meta{value} \hfill
2985% \tcboxverb{Default: none}\\
2986% |n| is meant to provide a number or any kind of label for the
2987% division and does not have to be unique in the document.\\
2988% \DescribeOption{head} |head|$=$\meta{name}
2989% \hfill\tcboxverb{Default: none}\\
2990% |head| holds the title of the division and may further contain
2991% variant readings.\\
2992% \DescribeOption{barehead} |barehead|$=$\meta{name}
2993% \hfill\tcboxverb{Default: none}\\
2994% |barehead| is supposed to be used to prevent unwanted commands from
2995% going into such places as headers, footers and the table of
2996% contents.\\
2997% \DescribeOption{depth} |depth|$=$\meta{n} where $1\leq n\leq 9$
2998% \hfill\tcboxverb{Default: 1}\\
2999% As \texttt{TEI} un-numbered divisions are simply |<div>| elements
3000% allowed to nest recursively to indicate their hierarchic depth and
3001% \cs{ekddiv} is an \enquote*{open} \LaTeX\ command, |n| is needed to
3002% indicate the depth of the division within the hierarchy, the largest
3003% being |1| and the smallest being |9|.\\
3004% \DescribeOption{toc}
3005% |toc|$=$\verb+|book|part|chapter|section|subsection|subsubsection|paragraph+\\
3006% |subparagraph|\hfill\tcboxverb{Default: not set}\\
3007% If |toc| be set, the title of the division goes into the table of
3008% contents at the hierarchic level that is specified as value.
3009%
3010% \paragraph{Formatting the Titles}
3011% \DescribeMacro{\EkdosisFormatDivision} By design, \pkg{ekdosis} does
3012% not format the titles. Instead, depending on what is needed for the
3013% edition text, \cs{EkdosisFormatDivision}\marg{n}\marg{code
3014% before}\marg{code after} is provided to lay out the titles of any
3015% hierarchic depth of division. This command takes three mandatory
3016% arguments as follows: \meta{n}, which is the number referring to the
3017% particular depth of division to be formatted and some \LaTeX\
3018% commands to go before and after the title itself. The following
3019% example illustrates how the titles of the largest division can be
3020% printed horizontally centered in a larger size:---
3021%
3022% \iffalse
3023%<*example>
3024% \fi
3025\begin{minted}[linenos=false]{latex}
3026\EkdosisFormatDivision{1}{\begin{center}\Large}{\end{center}}
3027\end{minted}
3028% \iffalse
3029%</example>
3030% \fi
3031%
3032% To elaborate on the example provided above in \vref{sec:latex-divs},
3033% here follows how the first three hierarchical levels could be
3034% formatted as un-numbered divisions:---
3035%
3036% \iffalse
3037%<*example>
3038% \fi
3039\begin{minted}[linenos=false]{latex}
3040% Preamble:
3041\EkdosisFormatDivision{1}{\begin{center}\Large}{\end{center}}
3042\EkdosisFormatDivision{2}{\begin{center}\large}{\end{center}}
3043\EkdosisFormatDivision{3}{\bfseries}{.}
3044
3045% Document:
3046\begin{ekdosis}
3047 \ekddiv{
3048 head={Ἱπποκράτους ἐπιδημιῶν
3049 \app{
3050 \lem[wit={I,R,H}]{βιβλίον δεύτερον}
3051 \rdg[wit=V]{λόγος β’}}},
3052 type=book,
3053 depth=1,
3054 n=II
3055 }
3056
3057 \ekddiv{
3058 head={<Τμῆμα πρῶτον>},
3059 type=section,
3060 depth=2,
3061 n=II.1
3062 }
3063
3064 \ekddiv{head=1, type=paragraph, depth=3, n=II.1.1}
3065 Ἄνθρακες θερινοὶ ἐν Κραννῶνι· [...]
3066\end{ekdosis}
3067\end{minted}
3068% \iffalse
3069%</example>
3070% \fi
3071%
3072% PDF output:---
3073% \medskip
3074%
3075% \resetlinenumber
3076% \EkdosisFormatDivision{1}{\begin{center}\Large}{\end{center}}
3077% \EkdosisFormatDivision{2}{\begin{center}\large}{\end{center}}
3078% \EkdosisFormatDivision{3}{\bfseries}{.}
3079% \begin{alignment}[flush,
3080% tcols=1,
3081% texts=hippocrates[xml:lang="grc"],
3082% apparatus=hippocrates]
3083% \AtBeginEnvironment{hippocrates}{\selectlanguage{greek}}
3084% \begin{hippocrates}
3085% \ekddiv{
3086% head={Ἱπποκράτους ἐπιδημιῶν
3087% \app{
3088% \lem[wit={hI,hR,hH}]{βιβλίον δεύτερον}
3089% \rdg[wit=hV]{λόγος β’}}},
3090% type=book,
3091% depth=1,
3092% n=II}
3093%
3094% \ekddiv{head={<Τμῆμα πρῶτον>}, type=section, depth=2, n=II.1}
3095%
3096% \ekddiv{head=1, type=paragraph, depth=3, n=II.1.1} Ἄνθρακες
3097% θερινοὶ ἐν Κραννῶνι· [...]
3098% \end{hippocrates}
3099% \end{alignment}
3100%
3101% \texttt{TEI xml} output:---
3102%
3103% \iffalse
3104%<*example>
3105% \fi
3106\begin{minted}[linenos=false]{xml}
3107<div xml:id="div-hippocrates_1" xml:lang="grc">
3108 <div type="book" n="II">
3109 <head>Ἱπποκράτους ἐπιδημιῶν
3110 <app>
3111 <lem wit="#I #R #H">βιβλίον δεύτερον</lem>
3112 <rdg wit="#V">λόγος β’</rdg>
3113 </app></head>
3114 <div type="section" n="II.1">
3115 <head>&lt;Τμῆμα πρῶτον&gt;</head>
3116 <div type="paragraph" n="II.1.1">
3117 <head>1</head>
3118 <p>Ἄνθρακες θερινοὶ ἐν Κραννῶνι· [...]</p>
3119 </div>
3120 </div>
3121 </div>
3122</div>
3123\end{minted}
3124% \iffalse
3125%</example>
3126% \fi
2855% 3127%
2856% \section{To Be Continued...} 3128% \section{To Be Continued...}
2857% v1.0 of \pkg{ekdosis}, which should be available by the end of July 3129% v1.0 of \pkg{ekdosis}, which should be available by the end of July
@@ -2862,7 +3134,7 @@ subtype="arabtex">'inna 'abI kAna mina
2862% \begin{comment} 3134% \begin{comment}
2863% \section{Correspondence and Alignment} 3135% \section{Correspondence and Alignment}
2864% \end{comment} 3136% \end{comment}
2865% \label{sec:correspondance-alignment} 3137% \label{sec:correspondence-alignment}
2866% 3138%
2867% \label{ref:segmentation} 3139% \label{ref:segmentation}
2868% 3140%
@@ -4925,14 +5197,14 @@ subtype="arabtex">'inna 'abI kAna mina
4925 initial depth = 1 5197 initial depth = 1
4926} 5198}
4927% \end{macrocode} 5199% \end{macrocode}
4928% \begin{macro}{\ekdfmtdiv} 5200% \begin{macro}{\EkdosisFormatDivision}
4929% \cs{ekdfmtdiv}\marg{n}\marg{code before}\marg{code after} is 5201% \cs{EkdosisFormatDivision}\marg{n}\marg{code before}\marg{code
4930% used to lay out the heading of the title. It takes three mandatory 5202% after} is used to lay out the heading of the title. It takes three
4931% arguments: \emph{n}, namely the number referring to the particular 5203% mandatory arguments: \emph{n}, namely the number referring to the
4932% depth of the division, and then some \LaTeX{} formatting commands 5204% particular depth of the division, and then some \LaTeX{} formatting
4933% to go before and after the heading itself:--- 5205% commands to go before and after the heading itself:---
4934% \begin{macrocode} 5206% \begin{macrocode}
4935\NewDocumentCommand{\ekdfmtdiv}{m m m}{ 5207\NewDocumentCommand{\EkdosisFormatDivision}{m m m}{
4936 \luadirect{ekdosis.fmtdiv(\luastring{#1}, 5208 \luadirect{ekdosis.fmtdiv(\luastring{#1},
4937 \luastringN{#2}, 5209 \luastringN{#2},
4938 \luastringN{#3})} 5210 \luastringN{#3})}
@@ -4940,7 +5212,7 @@ subtype="arabtex">'inna 'abI kAna mina
4940% \end{macrocode} 5212% \end{macrocode}
4941% \end{macro} 5213% \end{macro}
4942% \cs{ekd@getfmtdiv} gets the formatting commands that have been 5214% \cs{ekd@getfmtdiv} gets the formatting commands that have been
4943% stored by \cs{ekdfmtdiv}. 5215% stored by \cs{EkdosisFormatDivision}.
4944% \begin{macrocode} 5216% \begin{macrocode}
4945\NewDocumentCommand{\ekd@getfmtdiv}{m m}{% 5217\NewDocumentCommand{\ekd@getfmtdiv}{m m}{%
4946 \luadirect{tex.sprint(ekdosis.getfmtdiv(\luastringO{#1}, 5218 \luadirect{tex.sprint(ekdosis.getfmtdiv(\luastringO{#1},
@@ -4951,7 +5223,7 @@ subtype="arabtex">'inna 'abI kAna mina
4951% \cs{ekddiv}\marg{key-value arguments} is the standard command 5223% \cs{ekddiv}\marg{key-value arguments} is the standard command
4952% provided by \pkg{ekdosis} to meet the requirements of classical and 5224% provided by \pkg{ekdosis} to meet the requirements of classical and
4953% literary texts the divisions of which depend on many different 5225% literary texts the divisions of which depend on many different
4954% received traditions. It takes one optional argument in which the 5226% received traditions. It takes one mandatory argument in which the
4955% key-value arguments defined above are accepted, and converts the 5227% key-value arguments defined above are accepted, and converts the
4956% divisions into \texttt{TEI} \enquote*{un-numbered} |<div>| 5228% divisions into \texttt{TEI} \enquote*{un-numbered} |<div>|
4957% elements. 5229% elements.
diff --git a/samples/Caesar_BG-6-13-1.tex b/samples/Caesar_BG-6-13-1.tex
index 8002aec..ff793a6 100644
--- a/samples/Caesar_BG-6-13-1.tex
+++ b/samples/Caesar_BG-6-13-1.tex
@@ -13,7 +13,7 @@
13 delim=\hskip0.75em, 13 delim=\hskip0.75em,
14 ehook=.] 14 ehook=.]
15 15
16\ekdfmtdiv{2}{}{.} 16\EkdosisFormatDivision{2}{}{.}
17 17
18\SetEkdosisAlignment{ 18\SetEkdosisAlignment{
19 tcols=3, 19 tcols=3,
diff --git a/samples/Makefile b/samples/Makefile
index 518ec87..49bb11b 100644
--- a/samples/Makefile
+++ b/samples/Makefile
@@ -13,7 +13,6 @@ define dosamples
13 $(CMP) --shell-escape $1 >/dev/null 13 $(CMP) --shell-escape $1 >/dev/null
14endef 14endef
15 15
16
17all: 16all:
18 cp ../ekdosis.{lua,sty} . 17 cp ../ekdosis.{lua,sty} .
19 $(foreach file,$(texsamples), $(call dosamples, $(file))) 18 $(foreach file,$(texsamples), $(call dosamples, $(file)))
@@ -24,3 +23,5 @@ all:
24 rm -rf * 23 rm -rf *
25 cp -p -r .backup/* . 24 cp -p -r .backup/* .
26 rm -rf .backup 25 rm -rf .backup
26
27.PHONY: all