aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2021-03-25 10:53:27 +0100
committerRobert Alessi <alessi@robertalessi.net>2021-03-25 10:53:27 +0100
commit3296aeaae9cb2b4dce92b573ee2745aa03a3c3a3 (patch)
treeff0f3874589a606f63ea0bd5cc31bad0f515ea25
parent2a1051c7367679a3a8ecd4681db4de3c7a5d6cb0 (diff)
downloadekdosis-3296aeaae9cb2b4dce92b573ee2745aa03a3c3a3.tar.gz
poetry: added compatibility with the memoir class
-rw-r--r--ekdosis.dtx214
1 files changed, 189 insertions, 25 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx
index c27eab2..c7f6592 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -365,7 +365,7 @@ along with this program. If not, see
365 365
366@Software{verse, 366@Software{verse,
367 title = {The Verse package}, 367 title = {The Verse package},
368 subtitle = {Aids for typesetting simple verse}, 368 titleaddon = {Aids for typesetting simple verse},
369 author = {Wilson, Peter R. and Robertson, Will}, 369 author = {Wilson, Peter R. and Robertson, Will},
370 url = {http://www.ctan.org/pkg/verse}, 370 url = {http://www.ctan.org/pkg/verse},
371 date = {2014-05-10}, 371 date = {2014-05-10},
@@ -1233,9 +1233,9 @@ along with this program. If not, see
1233% comma-separated list of the following \enquote{name=value} arguments 1233% comma-separated list of the following \enquote{name=value} arguments
1234% that are used to collect items of information to be found within 1234% that are used to collect items of information to be found within
1235% the |<msIdentifer>| element in the \texttt{TEI} 1235% the |<msIdentifer>| element in the \texttt{TEI}
1236% header:---\footnote{See 1236% header:\footnote{See
1237% \url{https://tei-c.org/release/doc/tei-p5-doc/en/html/MS.html\#msid} 1237% \url{https://tei-c.org/release/doc/tei-p5-doc/en/html/MS.html\#msid}
1238% for detailed information on these elements.}\\ 1238% for detailed information on these elements.}---\\
1239% \DescribeOption{settlement} |settlement|$=$\meta{name}: The name of 1239% \DescribeOption{settlement} |settlement|$=$\meta{name}: The name of
1240% a city or administrative unit.\\ 1240% a city or administrative unit.\\
1241% \DescribeOption{institution} |institution|$=$\meta{name}: The name 1241% \DescribeOption{institution} |institution|$=$\meta{name}: The name
@@ -1460,8 +1460,8 @@ along with this program. If not, see
1460% and N, and β, which includes mss.\ T, f, U and l. Therefore, 1460% and N, and β, which includes mss.\ T, f, U and l. Therefore,
1461% provided that all these witnesses have been already declared, here 1461% provided that all these witnesses have been already declared, here
1462% is how the two families α and β could be 1462% is how the two families α and β could be
1463% declared:---\footnote{These witnesses are used in the example 1463% declared:\footnote{These witnesses are used in the example
1464% provided below in \vref{lst:caesar-bg}.} 1464% provided below in \vref{lst:caesar-bg}.}---
1465% \label{ref:caesar-bg-sigla} 1465% \label{ref:caesar-bg-sigla}
1466% \iffalse 1466% \iffalse
1467%<*example> 1467%<*example>
@@ -2675,6 +2675,7 @@ friend
2675% \end{remarks} 2675% \end{remarks}
2676% 2676%
2677% Finally, the corresponding \texttt{TEI xml} output follows:--- 2677% Finally, the corresponding \texttt{TEI xml} output follows:---
2678%
2678% \iffalse 2679% \iffalse
2679%<*example> 2680%<*example>
2680% \fi 2681% \fi
@@ -3662,10 +3663,10 @@ argument of the
3662% \env{verse} Environment} 3663% \env{verse} Environment}
3663% \label{sec:stand-verse-env} 3664% \label{sec:stand-verse-env}
3664% 3665%
3665% For typesetting verse texts or poems, \LaTeX\ provides the standard 3666% In order to typeset verse texts or poems, \LaTeX\ provides the
3666% \env{verse} environment. Within this environment, |\\| is normally 3667% standard \env{verse} environment. Within this environment, |\\| is
3667% used to end lines, with the exception of the last line. As a result, 3668% normally used to end lines, with the exception of the last line. As
3668% stanzas are separated from one another by a blank line. 3669% a result, stanzas are separated from one another by a blank line.
3669% 3670%
3670% \pkg{ekdosis} provides \env{ekdverse} which is recommended for use 3671% \pkg{ekdosis} provides \env{ekdverse} which is recommended for use
3671% in place of the standard \env{verse} environment. By default, 3672% in place of the standard \env{verse} environment. By default,
@@ -3700,10 +3701,10 @@ argument of the
3700% 3701%
3701% PDF output:--- 3702% PDF output:---
3702% \medskip 3703% \medskip
3704% \SetLineation{vmodulo=0}
3703% \begingroup 3705% \begingroup
3704% \needspace{7\baselineskip} 3706% \needspace{7\baselineskip}
3705% \resetlinenumber\resetvlinenumber 3707% \resetlinenumber\resetvlinenumber
3706% \poemlines{0}
3707% \begin{alignment}[flush,tcols=1,texts=coleridge,apparatus=coleridge] 3708% \begin{alignment}[flush,tcols=1,texts=coleridge,apparatus=coleridge]
3708% \begin{coleridge} 3709% \begin{coleridge}
3709% \begin{verse} 3710% \begin{verse}
@@ -3720,6 +3721,7 @@ argument of the
3720% \end{coleridge} 3721% \end{coleridge}
3721% \end{alignment} 3722% \end{alignment}
3722% \endgroup 3723% \endgroup
3724% \SetLineation{vmodulo=1}
3723% \medskip 3725% \medskip
3724% 3726%
3725% \indent\texttt{TEI xml} output:--- 3727% \indent\texttt{TEI xml} output:---
@@ -3752,8 +3754,118 @@ argument of the
3752% 3754%
3753% \subsection[The \textsf{verse} Package]{The \pkg{verse} Package} 3755% \subsection[The \textsf{verse} Package]{The \pkg{verse} Package}
3754% \label{sec:verse-package} 3756% \label{sec:verse-package}
3757% \pkg{ekdosis} can use the facilities offered by the excellent
3758% \pkg{verse} package\footcite{verse} to which it adds a specific
3759% environment for the encoding of line groups such as
3760% stanzas. Furthermore, as the \pkg{verse} package provides its own
3761% numbering mechanism, the lines can be numbered independently of
3762% prose text.
3763%
3764% \danger For what is described in this section to operate,
3765% \pkg{ekdosis} must be loaded with the global option |poetry=verse|
3766% as explained above \vpageref{ref:poetry-opt}. Simply loading the
3767% \pkg{verse} package by means of \cs{usepackage} will have no effect.
3768%
3769% \paragraph{Compatible Verse Commands}
3770% The reader is invited to refer to the documentation of the
3771% \env{verse} package for detailed information. Within the
3772% \env{ekdverse} environment, |\\| \emph{must be used} at the end of
3773% each line, as follows:---
3774% \begin{enumerate}
3775% \item |\\| is the standard command to be used at the end of each
3776% line.
3777% \item |\\!| must be used at the end of stanzas or line groups
3778% instead of |\\|.
3779% \item |\\*| does the same as |\\| except that it prohibits a page
3780% break after the line.
3781% \item |\\>| is for line breaks within a verse line.
3782% \end{enumerate}
3783%
3784% All of these commands can take a dimension as optional argument,
3785% like so: |\\[30pt]|, |\\![30pt]|, |\\*[30pt]| or |\\>[30pt]|. If
3786% |\\|, |\\!| or |\\*| be used, a vertical space of the dimension
3787% specified is added between lines, whereas |\\>[...]| adds an
3788% horizontal space after the line break.
3789%
3790% \DescribeMacro{\vin} \cs{vin} indents a verse line by a length which
3791% is by default \unit[1.5]{em}. This length is stored as \cs{vgap} and
3792% can be changed by \cs{setlength} or \cs{addtolength}.
3793%
3794% \paragraph{The \env{ekdverse} Environment}
3795% \DescribeEnv{ekdverse} \cs{begin}|{ekdverse}|\oarg{options} \dots\
3796% \cs{end}|{ekdverse}|\label{ref:ekdverse-syntax}\newfeature[v1.2]\\
3797% This environment is used to hold verse lines as described above and
3798% may receive an optional argument in which the following
3799% \enquote{name$=$value} arguments are accepted:---\\
3800% \DescribeOption{width} |width|$=$\meta{length}
3801% \hfill\tcboxverb{Default: \linewidth}\\
3802% If |width| be supplied, it is taken as a length in relation to which
3803% the entire contents of the environment is to be horizontally
3804% centered. If given, this dimension may correspond to an average line
3805% or to the longest line of the line group. To this end, the standard
3806% \LaTeX\ command \cs{settowidth} can be used, like so:--- %
3807% \iffalse
3808%<*example>
3809% \fi
3810\begin{minted}[linenos=false]{latex}
3811\settowidth{\versewidth}{This is the average line,}
3812\begin{ekdverse}[width=\versewidth]
3813...
3814\end{ekdverse}
3815\end{minted}
3816% \iffalse
3817%</example>
3818% \fi %
3819% \begin{remarks}
3820% \item[\textsc{Rem.}] \cs{versewidth} is provided by the \env{verse}
3821% package as a convenience and can be used by \env{ekdosis}.
3822% \end{remarks}
3823% \DescribeOption{type} |width|$=$\meta{type}
3824% \hfill\tcboxverb{Default: not set}\\
3825% This named argument is used in the \texttt{TEI xml} output to
3826% name the type of unit encoded within the |<lg>| element, viz.\
3827% \enquote{sonnet}, \enquote{quatrain}, \enquote{couplet} and the
3828% like.
3829%
3830% As an example, the first five lines of Homer's \emph{Odyssey} could
3831% be encoded like so:\footcite{HomerMurray}---
3755% 3832%
3833% \iffalse
3834%<*example>
3835% \fi
3836\begin{minted}[linenos=false]{latex}
3837\begin{alignment}[tcols=2,
3838 lcols=2,
3839 texts=homer[xml:lang="grc"];murray[xml:lang="en"],
3840 apparatus=homer]
3841 \begin{homer}
3842 \begin{ekdverse}
3843 Ἄνδρα μοι ἔννεπε, Μοῦσα, πολύτροπον, ὃς μάλα πολλὰ \\
3844 πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν· \\
3845 πολλῶν δ' ἀνθρώπων ἴδεν ἄστεα καὶ
3846 \app{\lem{νόον}
3847 \rdg[resp=Zen]{νόμον}
3848 \note{Cf. Schol.}} ἔγνω, \\
3849 πολλὰ δ' ὅ γ' ἐν πόντῳ πάθεν ἄλγεα ὃν κατὰ θυμόν, \\
3850 ἀρνύμενος ἥν τε ψυχὴν καὶ νόστον ἑταίρων. \\
3851 \end{ekdverse}
3852 \end{homer}
3853 \begin{murray}
3854 Tell me, O Muse, of the man of many devices, who wandered full
3855 many ways after he had sacked the sacred citadel of Troy. Many
3856 were the men whose cities he saw and whose mind he learned, aye,
3857 and many the woes he suffered in his heart upon the sea, seeking
3858 to win his own life and the return of his
3859 comrades.
3860 \end{murray}
3861\end{alignment}
3862\end{minted}
3863% \iffalse
3864%</example>
3865% \fi
3756% 3866%
3867% PDF output:---
3868% \medskip
3757% \begingroup 3869% \begingroup
3758% \setcolumnwidth{0.6\textwidth} 3870% \setcolumnwidth{0.6\textwidth}
3759% \setlength{\leftmargini}{0em} 3871% \setlength{\leftmargini}{0em}
@@ -3761,7 +3873,7 @@ argument of the
3761% \resetlinenumber\resetvlinenumber 3873% \resetlinenumber\resetvlinenumber
3762% \begin{alignment}[flush, 3874% \begin{alignment}[flush,
3763% lcols=2, 3875% lcols=2,
3764% texts=homer[xml:lang="grc"];murray, 3876% texts=homer[xml:lang="grc"];murray[xml:lang="en"],
3765% apparatus=homer] 3877% apparatus=homer]
3766% \AtBeginEnvironment{homer}{\selectlanguage{greek}} 3878% \AtBeginEnvironment{homer}{\selectlanguage{greek}}
3767% \setlength{\vrightskip}{0.25em} 3879% \setlength{\vrightskip}{0.25em}
@@ -3782,11 +3894,44 @@ argument of the
3782% many ways after he had sacked the sacred citadel of Troy. Many 3894% many ways after he had sacked the sacred citadel of Troy. Many
3783% were the men whose cities he saw and whose mind he learned, aye, 3895% were the men whose cities he saw and whose mind he learned, aye,
3784% and many the woes he suffered in his heart upon the sea, seeking 3896% and many the woes he suffered in his heart upon the sea, seeking
3785% to win his own life and the return of his 3897% to win his own life and the return of his comrades.
3786% comrades.\footcite{HomerMurray}
3787% \end{murray} 3898% \end{murray}
3788% \end{alignment} 3899% \end{alignment}
3789% \endgroup 3900% \endgroup
3901% \medskip
3902%
3903% \texttt{TEI xml} output:---
3904%
3905% \iffalse
3906%<*example>
3907% \fi
3908\begin{minted}[linenos=false]{xml}
3909<div xml:id="div-homer_1" xml:lang="grc">
3910 <lg>
3911 <l>Ἄνδρα μοι ἔννεπε, Μοῦσα, πολύτροπον, ὃς μάλα πολλὰ</l>
3912 <l>πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·</l>
3913 <l>πολλῶν δ' ἀνθρώπων ἴδεν ἄστεα καὶ
3914 <app>
3915 <lem>νόον</lem>
3916 <rdg resp="#Zen">νόμον</rdg>
3917 <note>Cf. Schol.</note>
3918 </app>ἔγνω,</l>
3919 <l>πολλὰ δ' ὅ γ' ἐν πόντῳ πάθεν ἄλγεα ὃν κατὰ θυμόν,</l>
3920 <l>ἀρνύμενος ἥν τε ψυχὴν καὶ νόστον ἑταίρων.</l>
3921 </lg>
3922</div>
3923<div xml:id="div-murray_1" xml:lang="en">
3924 <p>Tell me, O Muse, of the man of many devices, who
3925 wandered full many ways after he had sacked the sacred
3926 citadel of Troy. Many were the men whose cities he saw and
3927 whose mind he learned, aye, and many the woes he suffered
3928 in his heart upon the sea, seeking to win his own life and
3929 the return of his comrades.</p>
3930</div>
3931\end{minted}
3932% \iffalse
3933%</example>
3934% \fi
3790% 3935%
3791% \begingroup 3936% \begingroup
3792% \junicode 3937% \junicode
@@ -3862,12 +4007,15 @@ argument of the
3862% Pitty the world,or else this glutton be,\\ 4007% Pitty the world,or else this glutton be,\\
3863% To eate the worlds due,\app{ 4008% To eate the worlds due,\app{
3864% \lem{by the} 4009% \lem{by the}
3865% \rdg[resp=shStee, postwit=conj., type=conjecture]{be thy} 4010% \rdg[resp=shStee, type=conjecture]{be thy}
3866% \rdg[resp=shGod, postwit=conj., type=conjecture]{by thy} 4011% \note{conj.}
4012% \rdg[resp=shGod, type=conjecture]{by thy}
4013% \note{conj.}
3867% } graue 4014% } graue
3868% \app{ 4015% \app{
3869% \lem{and} 4016% \lem{and}
3870% \rdg[resp=shGod, postwit=conj., type=conjecture]{as} 4017% \rdg[resp=shGod, type=conjecture]{as}
4018% \note{conj.}
3871% } thee.\\! 4019% } thee.\\!
3872% \end{ekdstanza} 4020% \end{ekdstanza}
3873% \end{patverse} 4021% \end{patverse}
@@ -3876,6 +4024,8 @@ argument of the
3876% \end{alignment} 4024% \end{alignment}
3877% \endgroup 4025% \endgroup
3878% 4026%
4027% \url{https://www.bl.uk/collection-items/first-edition-of-shakespeares-sonnets-1609}
4028%
3879% \section{Lineation Settings} 4029% \section{Lineation Settings}
3880% \label{sec:lineation} 4030% \label{sec:lineation}
3881% \danger \pkg{ekdosis} uses \pkg{lineno} internally for line 4031% \danger \pkg{ekdosis} uses \pkg{lineno} internally for line
@@ -4960,14 +5110,15 @@ subtype="arabtex">'inna 'abI kAna mina
4960% of options} can be used in the preamble or at any point of the 5110% of options} can be used in the preamble or at any point of the
4961% document, except inside environments set to receive an apparatus 5111% document, except inside environments set to receive an apparatus
4962% criticus, namely the \env{ekdosis} environment or any other similar 5112% criticus, namely the \env{ekdosis} environment or any other similar
4963% environment declared by means of \cs{DeclareApparatus}.\footnote{See 5113% environment declared by means of the \env{alignment} environment or
4964% above \vref{sec:declaring-layers}.} At the time of writing, there is 5114% \cs{SetAlignment}.\footnote{See above
5115% \vref{sec:multiple-alignment}.} At the time of writing, there is
4965% only one option, as follows:---\\ 5116% only one option, as follows:---\\
4966% \DescribeOption{autopar} |autopar|$=$\verb+true|false+ 5117% \DescribeOption{autopar} |autopar|$=$\verb+true|false+
4967% \hfill\tcboxverb{Default: true}\\ 5118% \hfill\tcboxverb{Default: true}\\
4968% The algorithm described above applies for edition texts composed in 5119% The algorithm described above applies for edition texts composed in
4969% running paragraphs or in lines of poetry, but it may fail to produce 5120% running paragraphs or lines of poetry, but it may fail to produce a
4970% a valid \texttt{TEI xml} output with other arrangements, such as 5121% valid \texttt{TEI xml} output with other arrangements, such as
4971% performance texts or transcriptions of speech for which the 5122% performance texts or transcriptions of speech for which the
4972% \texttt{TEI} Guidelines define specific rules. |autopar=false| 5123% \texttt{TEI} Guidelines define specific rules. |autopar=false|
4973% instructs \pkg{ekdosis} to ignore blank lines in the |.tex| source 5124% instructs \pkg{ekdosis} to ignore blank lines in the |.tex| source
@@ -6528,6 +6679,9 @@ Sample text with a \textcolor{red}{word} in red.
6528 `tidy'.} 6679 `tidy'.}
6529} 6680}
6530\ekvoProcessLocalOptions{ekdosis} 6681\ekvoProcessLocalOptions{ekdosis}
6682\newif\ifekd@memoir@loaded
6683\@ifclassloaded{memoir}{%
6684 \ekd@memoir@loadedtrue\@pkg@poetry@versetrue}{}
6531% \end{macrocode} 6685% \end{macrocode}
6532% \paragraph{Required Packages} \label{ref:ekdrequirements} In 6686% \paragraph{Required Packages} \label{ref:ekdrequirements} In
6533% addition to \pkg{iftex}, \pkg{expkv-opt} and \pkg{expkv-def}, a list 6687% addition to \pkg{iftex}, \pkg{expkv-opt} and \pkg{expkv-def}, a list
@@ -7306,7 +7460,8 @@ Sample text with a \textcolor{red}{word} in red.
7306 vlineation=#1}{`vlineation' must be either `page' or `document'.}, 7460 vlineation=#1}{`vlineation' must be either `page' or `document'.},
7307 code modulonum = \chardef\c@linenumbermodulo#1\relax, 7461 code modulonum = \chardef\c@linenumbermodulo#1\relax,
7308 noval modulo = \modulolinenumbers, 7462 noval modulo = \modulolinenumbers,
7309 code vmodulo = \if@pkg@poetry@verse\poemlines{#1}\fi, 7463 code vmodulo = \ifekd@memoir@loaded\linenumberfrequency{#1}
7464 \else\if@pkg@poetry@verse\poemlines{#1}\fi\fi,
7310 initial vmodulo = 1, 7465 initial vmodulo = 1,
7311 default vmodulo = 5, 7466 default vmodulo = 5,
7312 bool continuousvnum = \if@continuous@vnum, 7467 bool continuousvnum = \if@continuous@vnum,
@@ -8371,14 +8526,22 @@ Sample text with a \textcolor{red}{word} in red.
8371 initial width = \linewidth, 8526 initial width = \linewidth,
8372 code type = \def\type@value{#1}, 8527 code type = \def\type@value{#1},
8373} 8528}
8374\verselinenumfont{\normalfont\footnotesize} 8529\ifekd@memoir@loaded
8530 \linenumberfont{\normalfont\footnotesize}
8531\else
8532 \verselinenumfont{\normalfont\footnotesize}
8533\fi
8375\setcounter{poemline}{1} 8534\setcounter{poemline}{1}
8376\NewDocumentEnvironment{ekdverse}{!O{}}{% 8535\NewDocumentEnvironment{ekdverse}{!O{}}{%
8377 \ekvset{ekd@verse}{#1}% 8536 \ekvset{ekd@verse}{#1}%
8378 \if@continuous@vnum\setverselinenums{\thelinenumber}{0}\fi 8537 \if@continuous@vnum\setverselinenums{\thelinenumber}{0}\fi
8379 \nolinenumbers 8538 \nolinenumbers
8380 \let\linelabel\label 8539 \let\linelabel\label
8381 \stepcounter{verse@envctr}% 8540 \ifekd@memoir@loaded
8541 \refstepcounter{verse}%
8542 \else
8543 \stepcounter{verse@envctr}%
8544 \fi
8382 \addtocounter{poemline}{-1}\refstepcounter{poemline}% 8545 \addtocounter{poemline}{-1}\refstepcounter{poemline}%
8383 \setcounter{vslineno}{1}% 8546 \setcounter{vslineno}{1}%
8384 \let\\=\@vscentercr 8547 \let\\=\@vscentercr
@@ -8508,8 +8671,8 @@ local sections = lpeg.Cs(lpeg.P("book") + lpeg.P("part") + lpeg.P("chapter")
8508 + lpeg.P("section") + lpeg.P("subsection") 8671 + lpeg.P("section") + lpeg.P("subsection")
8509 + lpeg.P("subsubsection")) 8672 + lpeg.P("subsubsection"))
8510local par = lpeg.P(lpeg.P("\\par") * spce^0) 8673local par = lpeg.P(lpeg.P("\\par") * spce^0)
8511local parb = lpeg.P(lpeg.Cs("\\p@rb") * spce^0) 8674local parb = lpeg.P(lpeg.P("\\p@rb") * spce^0)
8512local para = lpeg.P(lpeg.Cs("\\p@ra") * spce^0) 8675local para = lpeg.P(lpeg.P("\\p@ra") * spce^0)
8513local labelrefcmds = lpeg.Cs(lpeg.P("label") 8676local labelrefcmds = lpeg.Cs(lpeg.P("label")
8514 + lpeg.P("linelabel") 8677 + lpeg.P("linelabel")
8515 + lpeg.P("lineref") 8678 + lpeg.P("lineref")
@@ -8856,6 +9019,7 @@ local texpatttotags = {
8856 {a="\\resetlinenumber%s+%[(.-)%]", b=""}, 9019 {a="\\resetlinenumber%s+%[(.-)%]", b=""},
8857 {a="\\resetlinenumber%s+", b=""}, 9020 {a="\\resetlinenumber%s+", b=""},
8858 {a="\\indentpattern%s+{(.-)}", b=""}, 9021 {a="\\indentpattern%s+{(.-)}", b=""},
9022 {a="\\settowidth%s+{(.-)}{(.-)}", b=""},
8859 {a="\\poemlines%s+{(.-)}", b=""}, 9023 {a="\\poemlines%s+{(.-)}", b=""},
8860 {a="\\pagebreak%s+%[[1-4]%]", b=""}, 9024 {a="\\pagebreak%s+%[[1-4]%]", b=""},
8861 {a="\\pagebreak%s+", b=""}, 9025 {a="\\pagebreak%s+", b=""},