aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ekdosis.dtx288
1 files changed, 277 insertions, 11 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx
index dab30cc..09c1503 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -130,6 +130,24 @@ along with this program. If not, see
130 date = {2005-11-02}, 130 date = {2005-11-02},
131 version = {4.41} 131 version = {4.41}
132} 132}
133
134@Software{polyglossia,
135 title = {The Polyglossia package},
136 titleaddon = {An alternative to babel for XeLaTeX and LuaLaTeX},
137 author = {Charette, François and Reutenauer, Arthur},
138 url = {http://www.ctan.org/pkg/polyglossia},
139 date = {2020-04-08},
140 version = {1.49}
141}
142
143@Software{babel,
144 title = {The Babel package},
145 titleaddon = {Multilingual support for Plain TeX or LaTeX},
146 author = {Bezos López, Javier and Braams, Johannes L.},
147 url = {http://www.ctan.org/pkg/babel},
148 date = {2020-07-13},
149 version = {3.47}
150}
133\end{filecontents} 151\end{filecontents}
134\begin{filecontents}[overwrite]{\jobname-cfg.tex} 152\begin{filecontents}[overwrite]{\jobname-cfg.tex}
135\footnotelayout{m} 153\footnotelayout{m}
@@ -140,6 +158,12 @@ along with this program. If not, see
140\DeclareApparatus{default}[ 158\DeclareApparatus{default}[
141 delim=\hskip0.75em, 159 delim=\hskip0.75em,
142 ehook=.] 160 ehook=.]
161\DeclareApparatus{ltr}[
162 delim=\hskip0.75em]
163\DeclareApparatus{rtl}[
164 direction=RL,
165 sep={[ },
166 delim=\hskip0.75em]
143\DeclareWitness{M}{M}{\emph{Marcianus Gr.} 269}[ 167\DeclareWitness{M}{M}{\emph{Marcianus Gr.} 269}[
144 settlement=Venice, 168 settlement=Venice,
145 institution=Marciana Library, 169 institution=Marciana Library,
@@ -702,7 +726,7 @@ along with this program. If not, see
702% 726%
703% \needspace{4\baselineskip}PDF output:--- 727% \needspace{4\baselineskip}PDF output:---
704% \medskip 728% \medskip
705% \begin{alignment}[tcols=1,texts=specimen,apparatus=specimen] 729% \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
706% \begin{specimen} 730% \begin{specimen}
707% I 731% I
708% \app{ 732% \app{
@@ -1377,7 +1401,7 @@ yesterday.
1377%</example> 1401%</example>
1378% \fi 1402% \fi
1379% \resetlinenumber 1403% \resetlinenumber
1380% \begin{alignment}[tcols=1,texts=specimen,apparatus=specimen] 1404% \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
1381% \begin{specimen} 1405% \begin{specimen}
1382% I \app{\lem[wit=pjA]{saw}\rdg[wit=pjB]{met}} my friend 1406% I \app{\lem[wit=pjA]{saw}\rdg[wit=pjB]{met}} my friend
1383% \app{ 1407% \app{
@@ -1578,7 +1602,7 @@ yesterday.
1578% 1602%
1579% \resetlinenumber 1603% \resetlinenumber
1580% \ekdfmtdiv{2}{}{.} 1604% \ekdfmtdiv{2}{}{.}
1581% \begin{alignment}[lcols=2, 1605% \begin{alignment}[flush,lcols=2,
1582% texts=edition[xml:lang="la"]; 1606% texts=edition[xml:lang="la"];
1583% translation[xml:lang="en"]] 1607% translation[xml:lang="en"]]
1584% \AtBeginEnvironment{edition}{\selectlanguage{latin}} 1608% \AtBeginEnvironment{edition}{\selectlanguage{latin}}
@@ -1772,11 +1796,11 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+
1772% \DescribeOption{flush} |flush|$=$\verb+true|false+ 1796% \DescribeOption{flush} |flush|$=$\verb+true|false+
1773% \hfill\tcboxverb{Default: false}\\ 1797% \hfill\tcboxverb{Default: false}\\
1774% This named argument does not need a value as it defaults to |true| 1798% This named argument does not need a value as it defaults to |true|
1775% if it is used. This option applies on rare occasions only, when two 1799% if it is used. This option applies when two or more distinct
1776% or more distinct \env{alignment} environments are started on the same 1800% \env{alignment} environments are started on the same page. Should
1777% page. Should this happen, any subsequent \env{alignment} environment 1801% this happen, any subsequent \env{alignment} environment must be set
1778% must be set with the |flush| option so that every one of them 1802% with the |flush| option so that every one of them carry its own
1779% carry its own apparatus criticus. 1803% apparatus criticus.
1780% 1804%
1781% As an example, the alignment of the Latin edition text of Caesar's 1805% As an example, the alignment of the Latin edition text of Caesar's
1782% \emph{Gallic War}, printed on left-hand pages, along with two 1806% \emph{Gallic War}, printed on left-hand pages, along with two
@@ -1841,6 +1865,28 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+
1841% \cs{SetEkdosisAlignment} can be used either in the preamble or at 1865% \cs{SetEkdosisAlignment} can be used either in the preamble or at
1842% any point of the document to set or to modify alignment settings. 1866% any point of the document to set or to modify alignment settings.
1843% 1867%
1868% \subsubsection{Appending Hooks to Environments}
1869% \label{sec:alignment-hooks}
1870% \DescribeMacro{\AtBeginEnvironment} Once environments corresponding
1871% to texts to be aligned have been defined, it is advisable to use the
1872% \cs{AtBeginEnvironment}\marg{environment}\marg{code} command that is
1873% provided by the \pkg{etoolbox} package\footnote{This package is
1874% loaded by \pkg{ekdosis}.} to further adjust languages, hyphenation
1875% rules, and/or fonts to be applied in each environment. To return to
1876% the example provided above, once \cs{SetEkdosisAlignment} has been
1877% used, the languages can be set as follows:---
1878%
1879% \iffalse
1880%<*example>
1881% \fi
1882\begin{minted}[linenos=false]{latex}
1883\AtBeginEnvironment{latin}{\selectlanguage{latin}}
1884\AtBeginEnvironment{english}{\selectlanguage{english}}
1885\AtBeginEnvironment{french}{\selectlanguage{french}}
1886\end{minted}
1887% \iffalse
1888%</example>
1889% \fi
1844% 1890%
1845% \section{Laying Out the Apparatus Criticus } 1891% \section{Laying Out the Apparatus Criticus }
1846% \label{sec:apparatus-layout} 1892% \label{sec:apparatus-layout}
@@ -2173,7 +2219,7 @@ Some \app[type=rec2]{
2173% been chosen, must be used if the editor wishes to retain that 2219% been chosen, must be used if the editor wishes to retain that
2174% information in the \texttt{TEI xml} output file. 2220% information in the \texttt{TEI xml} output file.
2175% 2221%
2176% \subsection{Other Notes, Comments, Sources, Testimonia} 2222% \subsection{Other Notes for Comments, Sources or Testimonia}
2177% \label{ref:type-note} 2223% \label{ref:type-note}
2178% Additional layers of notes can be used to print short comments or to 2224% Additional layers of notes can be used to print short comments or to
2179% record references to texts quoted by the author of the edited text 2225% record references to texts quoted by the author of the edited text
@@ -2268,7 +2314,7 @@ Some \app[type=rec2]{
2268% PDF output:--- 2314% PDF output:---
2269% \medskip 2315% \medskip
2270% \resetlinenumber 2316% \resetlinenumber
2271% \begin{alignment}[tcols=1,texts=specimen,apparatus=specimen] 2317% \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
2272% \begin{specimen} 2318% \begin{specimen}
2273% The oldest monument of the Germans is their language, which, 2319% The oldest monument of the Germans is their language, which,
2274% before untold centuries, was the companion of their travels from 2320% before untold centuries, was the companion of their travels from
@@ -2424,6 +2470,13 @@ argument of the
2424% digits in the group 10 to 19 in each hundred\---viz. 17--19, 115--18 2470% digits in the group 10 to 19 in each hundred\---viz. 17--19, 115--18
2425% \emph{\&c.} |numbers=full| leaves the numbers untouched. 2471% \emph{\&c.} |numbers=full| leaves the numbers untouched.
2426% 2472%
2473% \DescribeMacro{\innerlinenumbers} \DescribeMacro{\outerlinenumbers}
2474% \cs{innerlinenumbers} and \cs{outerlinenumbers} are equivalent to
2475% \cs{SetLineation}|{numb|\allowbreak|ers=outer}| and
2476% \cs{SetLineation}|{numbers=inner}| respectively. Both commands are
2477% complementary to \cs{rightlinenumbers} and \cs{leftlinenumbers}
2478% already provided by the \pkg{lineno} package.
2479%
2427% \paragraph{Useful Lineation Commands} 2480% \paragraph{Useful Lineation Commands}
2428% As implied above, pretty much all commands that are provided by the 2481% As implied above, pretty much all commands that are provided by the
2429% \enquote{running} mode of operation of the \pkg{lineno} package will 2482% \enquote{running} mode of operation of the \pkg{lineno} package will
@@ -2456,7 +2509,219 @@ argument of the
2456% \iffalse 2509% \iffalse
2457%</example> 2510%</example>
2458% \fi 2511% \fi
2512%
2513% \section{Languages}
2514% \label{sec:languages}
2515% \danger \pkg{ekdosis} is fully compatible with \pkg{babel}.
2516% \enquote{Fully compatible} means that all features provided by
2517% \pkg{babel}, including language switching commands, are supported by
2518% \pkg{ekdosis}. \pkg{ekdosis} is also compatible with
2519% \pkg{polyglossia} with one notable exception: \pkg{luabidi}, which
2520% \pkg{polyglossia} loads for languages written from right to left, is
2521% not supported by \pkg{ekdosis}, and most probably never will
2522% be. That said, as far as the author could see, single-layer
2523% apparatus, as described in \vref{sec:single-layer-app}, can be
2524% typeset within the Arabic environment that is provided by
2525% \pkg{polyglossia}. Unfortunately, the same cannot be said for
2526% multi-layer apparatus.
2527%
2528% Whether \pkg{babel} or \pkg{polyglossia} is used, \pkg{ekdosis}
2529% automatically applies the current language to the entries of the
2530% apparatus criticus, including the fonts that may have been
2531% associated to the languages in the preamble. In this respect, as
2532% \pkg{polyglossia} can use the same language switching commands as
2533% \pkg{babel},\footcite[See][3.2 \pno~14]{polyglossia} the general
2534% advice given above in \vref{sec:alignment-hooks} applies in all
2535% cases.
2536%
2537% \subsection{Languages Written From Right to Left}
2538% \label{sec:rtl-languages}
2539% As said above, \pkg{polyglossia} is not supported by \pkg{ekdosis}
2540% for languages that are written and read from right to left, like
2541% Arabic, Hebrew or Syriac. However, as \pkg{babel} is supported and
2542% can be loaded concurrently with \pkg{polyglossia}, an easy way is to
2543% always use \pkg{babel} to print such languages.
2544%
2545% \danger The reader is invited to refer to and become acquainted with
2546% the relevant parts of the documentation of the \pkg{babel}
2547% package.\footcite{babel}
2548%
2549% \paragraph{\pkg{babel} Only}
2550% In the following example, \pkg{babel} is used exclusively to set
2551% three different languages: Arabic, ancient Greek and English:---
2552%
2553% \captof{Multilingual editions with \pkg{babel} only}
2554% \iffalse
2555%<*example>
2556% \fi
2557\begin{minted}{latex}
2558\usepackage{fontspec}
2559
2560\usepackage[greek.ancient,english]{babel}
2561\babelprovide[onchar=fonts]{arabic}
2562
2563\babelfont{rm}{Old Standard}
2564\babelfont[greek]{rm}[RawFeature={+ss05;+ss06}]{Old Standard}
2565\babelfont[*arabic]{rm}{Amiri}
2566
2567\babeltags{ancientgreek = greek}
2568\newcommand{\sg}[1]{\textancientgreek{#1}}
2569
2570\newcommand{\RL}[1]{\bgroup\textdir TRT#1\egroup}
2571\newenvironment{Arabic}{\par\pardir TRT\textdir TRT}{\par}
2572\end{minted}
2573% \iffalse
2574%</example>
2575% \fi
2576%
2577% \begin{remarks}
2578% \item As can be seen, \pkg{fontspec} has been loaded before
2579% \pkg{babel}. To the author's knowledge, this gives better results
2580% when \cs{babelfont} is used.
2581% \item Line~3 loads \pkg{babel} and instructs it to use English as
2582% the default language and ancient Greek as a second optional
2583% language. As can be seen, the built-in |bidi| mechanism provided
2584% by \pkg{babel} is not enabled. As a result, specific language
2585% switching commands for Arabic must be defined just as it must be
2586% for every other language.
2587% \item Line~4 does not load any Arabic, but instructs \pkg{babel}
2588% that it should use the Arabic font that is set with \cs{babelfont}
2589% whenever an Arabic letter is encountered.
2590% \item Lines~6--8 select the fonts: |Old Standard| is the default
2591% font to be used for Roman shape (l.~6); the same font is used for
2592% Greek, with some additional Open Type features enabled; finally,
2593% the |Amiri| font is used for Arabic.
2594% \item Lines~10--11 define so-called \enquote{tags} for easier access
2595% to ancient Greek through \cs{begin}|{ancient|\allowbreak|greek}|
2596% \dots\ \cs{end}|{ancientgreek}| for running paragraphs and
2597% \cs{textancientgreek}\marg{text} for short insertions of Greek in
2598% English text. \cs{sg}\marg{text} is just a shorthand for this
2599% latter command.
2600% \item Finally, lines~13--14 define simple language switching
2601% commands for Arabic. As can be seen, no commands other than the
2602% \LuaTeX\ primitives \cs{pardir} and \cs{textdir} have been used
2603% for \pkg{babel} takes care of selecting the Arabic font. \cs{RL}
2604% is for short insertions of Arabic words in English paragraphs
2605% while \cs{begin}|{Arabic}| \dots\ \cs{end}|{Arabic}| is for
2606% running paragraphs of Arabic text.
2607% \end{remarks}
2608%
2609% \paragraph{Changing the Writing Direction}
2610% \DescribeMacro{\setRL} \DescribeMacro{\setLR} \cs{setRL} and
2611% \cs{setLR} are two argument-less commands provided by \pkg{ekdosis}
2612% that can be used to change the writing direction of running
2613% paragraphs. The former sets the direction from right to left and the
2614% latter form left to right. If \pkg{babel} has been set as above,
2615% \cs{setRL} \dots\ \cs{setLR} can be used in place of
2616% \cs{begin}|{Arabic}| \dots\ \cs{end}|{Arabic}|.
2459% 2617%
2618% \paragraph{\pkg{polyglossia} Associated With \cs{babelprovide}}
2619% What follows illustrates how \pkg{babel} can be used conjointly with
2620% \pkg{polyglossia} for the same three languages as above without
2621% having to load \pkg{luabidi}:---
2622%
2623% \captof{Multilingual editions with \pkg{babel} and
2624% \pkg{polyglossia}}
2625% \iffalse
2626%<*example>
2627% \fi
2628\begin{minted}{latex}
2629\usepackage{fontspec}
2630
2631\usepackage{babel}
2632\babelprovide[onchar=fonts]{arabic}
2633
2634\setmainfont{Old Standard}
2635\newfontfamily\greekfont{Old Standard}[RawFeature={+ss05;+ss06}]
2636\babelfont[*arabic]{rm}{Amiri}
2637
2638\usepackage{polyglossia}
2639\setdefaultlanguage{english}
2640\setotherlanguage[variant=ancient]{greek}
2641
2642\newcommand{\textarabic}[1]{\bgroup\textdir TRT#1\egroup}
2643\newenvironment{Arabic}{\par\pardir TRT\textdir TRT}{\par}
2644\end{minted}
2645% \iffalse
2646%</example>
2647% \fi
2648%
2649% \begin{remarks}
2650% \item Line~3 just loads \pkg{babel} with no default language.
2651% \item Lines~4 and 8 are used to have the Arabic font automatically
2652% selected as above.
2653% \item Lines~14--15 define the exact language switching commands that
2654% would have been defined if \pkg{polyglossia} and \pkg{luabidi} had
2655% been used for Arabic.
2656% \end{remarks}
2657%
2658% As one can see, the important point about languages written from
2659% right to left is to use \pkg{babel} only to select the Arabic fonts,
2660% avoid using the bidirectional mechanism it provides and define
2661% commands and environments that use \LuaTeX\ primitives to set the
2662% writing direction. Then, an Arabic edition text\---to continue with
2663% this example\---can be entered as follows:---
2664%
2665% \iffalse
2666%<*example>
2667% \fi
2668\begin{minted}[linenos=false,escapeinside=++]{latex}
2669\begin{ekdosis}
2670 \begin{Arabic}
2671 +\txarb{إِنَّ أَبِي كَانَ مِنَ}+ \app{
2672 \lem{+\txarb{ٱلْمُقَاتِلَةِ}+}
2673 \rdg{+\txarb{ٱلْمُقَاتِلِينَ}+}
2674 } +\txarb{وَ كَانَتْ أُمِّي مِنْ عُظَمَآءِ بُيُوتِ ٱلزَّمَازِمَةِ۔}+
2675 \end{Arabic}
2676\end{ekdosis}
2677\end{minted}
2678% \iffalse
2679%</example>
2680% \fi
2681%
2682% It should be reminded that the writing direction of the apparatus
2683% criticus itself is independent of that of the edition text and must
2684% be set either with \cs{Set(LTR{\textbar}RTL)app}, with the
2685% |direction| optional argument of \cs{SetApparatus} for single-layer
2686% apparatus criticus, or by means of \cs{DeclareApparatus} for
2687% multiple-layer apparatus criticus.\footnote{See above
2688% \vref{sec:single-layer-app} (single-layer apparatus criticus) and
2689% \vref{sec:multilayer-apparatus} (multiple-layer apparatus
2690% criticus).}
2691%
2692% PDF output with left-to-right apparatus criticus:---
2693% \medskip
2694% \resetlinenumber
2695% \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
2696% \begin{specimen}
2697% \begin{arab}[fullvoc]
2698% 'inna 'abI kAna mina \app[type=ltr]{
2699% \lem{'l-muqAtilaTi}
2700% \rdg{'l-muqAtilIna}}
2701% wa-kAnat 'ummI min `u.zamA'i buyUti 'l-zamAzimaTi.
2702% \end{arab}
2703% \end{specimen}
2704% \end{alignment}
2705%
2706% PDF output with right-to-left apparatus criticus:---
2707% \medskip
2708% \resetlinenumber
2709% \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen]
2710% \begin{specimen}
2711% \begin{arab}[fullvoc]
2712% 'inna 'abI kAna mina \app[type=rtl]{
2713% \lem{'l-muqAtilaTi}
2714% \rdg{'l-muqAtilIna}}
2715% wa-kAnat 'ummI min `u.zamA'i buyUti 'l-zamAzimaTi.
2716% \end{arab}
2717% \end{specimen}
2718% \end{alignment}
2719%
2720%
2721% \subsection{Using \pkg{arabluatex}}
2722% \label{sec:using-arabluatex}
2723%
2724%
2460% \section{To Be Continued...} 2725% \section{To Be Continued...}
2461% v1.0 of \pkg{ekdosis}, which should be available by the end of July 2726% v1.0 of \pkg{ekdosis}, which should be available by the end of July
2462% 2020, will include a full documentation. At the time of writing, the 2727% 2020, will include a full documentation. At the time of writing, the
@@ -5706,7 +5971,7 @@ function ekdosis.newalignment(str)
5706 then 5971 then
5707 newalignment = false 5972 newalignment = false
5708 cur_alignment = "-" 5973 cur_alignment = "-"
5709 cur_alignment_patt = "-" 5974 cur_alignment_patt = "%-"
5710 end 5975 end
5711 return true 5976 return true
5712end 5977end
@@ -6132,6 +6397,7 @@ function ekdosis.testapparatus()
6132 if next(apparatuses) ~= nil then 6397 if next(apparatuses) ~= nil then
6133 reset_bagunits() 6398 reset_bagunits()
6134 end 6399 end
6400 newalignment = false
6135 return "\\booltrue{do@app}" 6401 return "\\booltrue{do@app}"
6136 end 6402 end
6137end 6403end