diff options
author | Robert Alessi <alessi@robertalessi.net> | 2021-03-14 20:40:07 +0100 |
---|---|---|
committer | Robert Alessi <alessi@robertalessi.net> | 2021-03-14 20:40:07 +0100 |
commit | 993a42f4327b64248980a92d8f06d1eb44866d1a (patch) | |
tree | a53c0766afd560f18ac62fad7aaeac6581f24a90 /ekdosis.dtx | |
parent | fd2c4128141939720f8122c58807051d63fb1f59 (diff) | |
download | ekdosis-993a42f4327b64248980a92d8f06d1eb44866d1a.tar.gz |
added support for 'patverse'. started documenting poetry
Diffstat (limited to 'ekdosis.dtx')
-rw-r--r-- | ekdosis.dtx | 168 |
1 files changed, 101 insertions, 67 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx index 1c35edb..bd95000 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx | |||
@@ -3657,19 +3657,45 @@ argument of the | |||
3657 | % | 3657 | % |
3658 | % \section{Poetry} | 3658 | % \section{Poetry} |
3659 | % \label{sec:poetry} | 3659 | % \label{sec:poetry} |
3660 | % For typesetting verse texts or poems, \LaTeX\ provides the standard | ||
3661 | % \env{verse} environment. Usually, within this environment, |\\| is | ||
3662 | % used to end lines, with the exception of the last line. Likewise, | ||
3663 | % stanzas are separated from one another by a blank line. However, | ||
3664 | % \pkg{ekdosis} deviates a little from this usage for it needs all | ||
3665 | % lines of poetry to be ended by |\\| as a distinct marker, like | ||
3666 | % so:--- | ||
3660 | % | 3667 | % |
3668 | % \iffalse | ||
3669 | %<*example> | ||
3670 | % \fi | ||
3671 | \begin{minted}{latex} | ||
3672 | \begin{verse} | ||
3673 | It is an ancient Mariner,\\ | ||
3674 | And he stoppeth one of three.\\ | ||
3675 | ‘By thy long grey beard and glittering eye,\\ | ||
3676 | Now wherefore stopp'st thou me?\\[\parskip] | ||
3677 | % | ||
3678 | The Bridegroom's doors are opened wide,\\ | ||
3679 | And I am next of kin;\\ | ||
3680 | The guests are met, the feast is set:\\ | ||
3681 | May'st hear the merry din.’ | ||
3682 | \end{verse} | ||
3683 | \end{minted} | ||
3684 | % \iffalse | ||
3685 | %</example> | ||
3686 | % \fi | ||
3687 | % | ||
3661 | % \begingroup | 3688 | % \begingroup |
3662 | % \setcolumnwidth{0.6\textwidth} | 3689 | % \setcolumnwidth{0.6\textwidth} |
3663 | % \setlength{\leftmargini}{0em} | 3690 | % \setlength{\leftmargini}{0em} |
3664 | % \needspace{7\baselineskip} | 3691 | % \needspace{7\baselineskip} |
3665 | % \resetlinenumber | 3692 | % \resetlinenumber\resetvlinenumber |
3666 | % \begin{alignment}[flush, | 3693 | % \begin{alignment}[flush, |
3667 | % lcols=2, | 3694 | % lcols=2, |
3668 | % texts=homer[xml:lang="grc"];murray, | 3695 | % texts=homer[xml:lang="grc"];murray, |
3669 | % apparatus=homer] | 3696 | % apparatus=homer] |
3670 | % \AtBeginEnvironment{homer}{\selectlanguage{greek}} | 3697 | % \AtBeginEnvironment{homer}{\selectlanguage{greek}} |
3671 | % \setlength{\vrightskip}{0.25em} | 3698 | % \setlength{\vrightskip}{0.25em} |
3672 | % \setverselinenums{1}{0} | ||
3673 | % \begin{homer} | 3699 | % \begin{homer} |
3674 | % \begin{ekdverse} | 3700 | % \begin{ekdverse} |
3675 | % Ἄνδρα μοι ἔννεπε, Μοῦσα, πολύτροπον, ὃς μάλα πολλὰ \\ | 3701 | % Ἄνδρα μοι ἔννεπε, Μοῦσα, πολύτροπον, ὃς μάλα πολλὰ \\ |
@@ -3706,74 +3732,76 @@ argument of the | |||
3706 | % substantiall fewell,} | 3732 | % substantiall fewell,} |
3707 | % \FormatDiv{1}{\begin{ekdcenter}}{\end{ekdcenter}} | 3733 | % \FormatDiv{1}{\begin{ekdcenter}}{\end{ekdcenter}} |
3708 | % \needspace{7\baselineskip} | 3734 | % \needspace{7\baselineskip} |
3709 | % \resetlinenumber | 3735 | % \resetlinenumber\resetvlinenumber |
3710 | % \begin{alignment}[flush, | 3736 | % \begin{alignment}[flush, |
3711 | % tcols=1, | 3737 | % tcols=1, |
3712 | % texts=shakespeare[xml:lang="en"], | 3738 | % texts=shakespeare[xml:lang="en"], |
3713 | % apparatus=shakespeare] | 3739 | % apparatus=shakespeare] |
3714 | % \setverselinenums{1}{0} | ||
3715 | % \setlength{\vrightskip}{-0.75in} | 3740 | % \setlength{\vrightskip}{-0.75in} |
3716 | % \begin{shakespeare} | 3741 | % \begin{shakespeare} |
3717 | % \ekddiv{type=sonnets, n=1, head=1} | 3742 | % \ekddiv{type=sonnets, n=1, head=1} |
3718 | % \begin{ekdverse}[type=sonnet, width=\versewidth] | 3743 | % \begin{ekdverse}[type=sonnet, width=\versewidth] |
3719 | % \begin{ekdstanza}[type=quatrain] | 3744 | % \indentpattern{00000000000011} |
3720 | % \ekdlettrine{F}{r}om fairest creatures we desire | 3745 | % \begin{patverse} |
3721 | % increase,\\[-1.875ex] | 3746 | % \begin{ekdstanza}[type=quatrain] |
3722 | % \vin That thereby beauties \emph{Rose} | 3747 | % \ekdlettrine{F}{r}om fairest creatures we desire |
3723 | % \app{ | 3748 | % increase,\\[-1.875ex] |
3724 | % \lem{might} | 3749 | % \vin That thereby beauties \emph{Rose} |
3725 | % \rdg[source={shGildon1710, shSewell1725, shEwing1771}]{may} | 3750 | % \app{ |
3726 | % } neuer die,\\ | 3751 | % \lem{might} |
3727 | % But as the riper should by time | 3752 | % \rdg[source={shGildon1710, shSewell1725, shEwing1771}]{may} |
3728 | % \app{ | 3753 | % } neuer die,\\ |
3729 | % \lem{decease} | 3754 | % But as the riper should by time |
3730 | % \rdg[source=shHudson1856]{decrease} | 3755 | % \app{ |
3731 | % },\\ | 3756 | % \lem{decease} |
3732 | % His tender heire might beare his memory:\\ | 3757 | % \rdg[source=shHudson1856]{decrease} |
3733 | % \end{ekdstanza} | 3758 | % },\\ |
3734 | % \begin{ekdstanza}[type=quatrain] | 3759 | % His tender heire might beare his memory:\\ |
3735 | % But thou contracted to thine owne bright eyes,\\ | 3760 | % \end{ekdstanza} |
3736 | % Feed'st thy | 3761 | % \begin{ekdstanza}[type=quatrain] |
3737 | % \app{ | 3762 | % But thou contracted to thine owne bright eyes,\\ |
3738 | % \lem{lights} | 3763 | % Feed'st thy |
3739 | % \rdg[source={shButler1899, shWalsh1908}]{life's} | 3764 | % \app{ |
3740 | % } flame with | 3765 | % \lem{lights} |
3741 | % \app{ | 3766 | % \rdg[source={shButler1899, shWalsh1908}]{life's} |
3742 | % \lem{selfe substantiall} | 3767 | % } flame with |
3743 | % \rdg[source=shGildon1714, | 3768 | % \app{ |
3744 | % alt={\textnormal{Hyphened by}}]{selfe-substantiall} | 3769 | % \lem{selfe substantiall} |
3745 | % \note{etc.}} fewell,\\ | 3770 | % \rdg[source=shGildon1714, |
3746 | % Making a famine where aboundance lies,\\ | 3771 | % alt={\textnormal{Hyphened by}}]{selfe-substantiall} |
3747 | % Thy selfe thy foe,to thy sweet selfe too cruell:\\ | 3772 | % \note{etc.}} fewell,\\ |
3748 | % \end{ekdstanza} | 3773 | % Making a famine where aboundance lies,\\ |
3749 | % \begin{ekdstanza}[type=quatrain] | 3774 | % Thy selfe thy foe,to thy sweet selfe too cruell:\\ |
3750 | % Thou that art now the worlds fresh ornament,\\ | 3775 | % \end{ekdstanza} |
3751 | % And | 3776 | % \begin{ekdstanza}[type=quatrain] |
3752 | % \app{ | 3777 | % Thou that art now the worlds fresh ornament,\\ |
3753 | % \lem{only} | 3778 | % And |
3754 | % \rdg[resp=shGod, type=conjecture]{early} | 3779 | % \app{ |
3755 | % \note{conj.} | 3780 | % \lem{only} |
3756 | % } herauld to the gaudy spring,\\ | 3781 | % \rdg[resp=shGod, type=conjecture]{early} |
3757 | % Within thine owne bud buriest thy content,\\ | 3782 | % \note{conj.} |
3758 | % And tender | 3783 | % } herauld to the gaudy spring,\\ |
3759 | % \app{ | 3784 | % Within thine owne bud buriest thy content,\\ |
3760 | % \lem{chorle} | 3785 | % And tender |
3761 | % \rdg[source=shGildon1710]{churl} | 3786 | % \app{ |
3762 | % \note{etc.} | 3787 | % \lem{chorle} |
3763 | % } makst wast in niggarding:\\ | 3788 | % \rdg[source=shGildon1710]{churl} |
3764 | % \end{ekdstanza} | 3789 | % \note{etc.} |
3765 | % \begin{ekdstanza}[type=couplet] | 3790 | % } makst wast in niggarding:\\ |
3766 | % \vin Pitty the world,or else this glutton be,\\ | 3791 | % \end{ekdstanza} |
3767 | % \vin To eate the worlds due,\app{ | 3792 | % \begin{ekdstanza}[type=couplet] |
3793 | % Pitty the world,or else this glutton be,\\ | ||
3794 | % To eate the worlds due,\app{ | ||
3768 | % \lem{by the} | 3795 | % \lem{by the} |
3769 | % \rdg[resp=shStee, postwit=conj., type=conjecture]{be thy} | 3796 | % \rdg[resp=shStee, postwit=conj., type=conjecture]{be thy} |
3770 | % \rdg[resp=shGod, postwit=conj., type=conjecture]{by thy} | 3797 | % \rdg[resp=shGod, postwit=conj., type=conjecture]{by thy} |
3771 | % } graue | 3798 | % } graue |
3772 | % \app{ | 3799 | % \app{ |
3773 | % \lem{and} | 3800 | % \lem{and} |
3774 | % \rdg[resp=shGod, postwit=conj., type=conjecture]{as} | 3801 | % \rdg[resp=shGod, postwit=conj., type=conjecture]{as} |
3775 | % } thee.\\! | 3802 | % } thee.\\! |
3776 | % \end{ekdstanza} | 3803 | % \end{ekdstanza} |
3804 | % \end{patverse} | ||
3777 | % \end{ekdverse} | 3805 | % \end{ekdverse} |
3778 | % \end{shakespeare} | 3806 | % \end{shakespeare} |
3779 | % \end{alignment} | 3807 | % \end{alignment} |
@@ -5479,7 +5507,7 @@ Sample text with a \textcolor{red}{word} in red. | |||
5479 | % | 5507 | % |
5480 | % \needspace{7\baselineskip} | 5508 | % \needspace{7\baselineskip} |
5481 | % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen] | 5509 | % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen] |
5482 | % \setverselinenums{30}{0} | 5510 | % \resetlinenumber\resetvlinenumber[30] |
5483 | % \setlength{\vrightskip}{-1.5in} | 5511 | % \setlength{\vrightskip}{-1.5in} |
5484 | % \begin{specimen} | 5512 | % \begin{specimen} |
5485 | % \begin{ekdverse} | 5513 | % \begin{ekdverse} |
@@ -8238,7 +8266,7 @@ Sample text with a \textcolor{red}{word} in red. | |||
8238 | } | 8266 | } |
8239 | \verselinenumfont{\normalfont\footnotesize} | 8267 | \verselinenumfont{\normalfont\footnotesize} |
8240 | \setcounter{poemline}{1} | 8268 | \setcounter{poemline}{1} |
8241 | \NewDocumentEnvironment{ekdverse}{O{}}{% | 8269 | \NewDocumentEnvironment{ekdverse}{!O{}}{% |
8242 | \ekvset{ekd@verse}{#1}% | 8270 | \ekvset{ekd@verse}{#1}% |
8243 | \if@continuous@vnum\setverselinenums{\thelinenumber}{0}\fi | 8271 | \if@continuous@vnum\setverselinenums{\thelinenumber}{0}\fi |
8244 | \nolinenumbers | 8272 | \nolinenumbers |
@@ -8270,7 +8298,7 @@ Sample text with a \textcolor{red}{word} in red. | |||
8270 | \else | 8298 | \else |
8271 | \newlength{\ekdverseindentlength} | 8299 | \newlength{\ekdverseindentlength} |
8272 | \setlength{\ekdverseindentlength}{\parindent} | 8300 | \setlength{\ekdverseindentlength}{\parindent} |
8273 | \NewDocumentEnvironment{ekdverse}{O{\ekdverseindentlength}}{ | 8301 | \NewDocumentEnvironment{ekdverse}{!O{\ekdverseindentlength}}{ |
8274 | \begin{list}{}{% | 8302 | \begin{list}{}{% |
8275 | \setlength{\leftmargin}{#1} | 8303 | \setlength{\leftmargin}{#1} |
8276 | \setlength{\itemsep}{0pt} | 8304 | \setlength{\itemsep}{0pt} |
@@ -8299,10 +8327,12 @@ Sample text with a \textcolor{red}{word} in red. | |||
8299 | % \changes{v1.2}{2021/03/08}{new environment for stanzas} | 8327 | % \changes{v1.2}{2021/03/08}{new environment for stanzas} |
8300 | % \begin{macrocode} | 8328 | % \begin{macrocode} |
8301 | \ekvdefinekeys{ekd@stanza}{ | 8329 | \ekvdefinekeys{ekd@stanza}{ |
8302 | code type = \def\type@value{#1} | 8330 | code type = \def\type@value{#1} |
8303 | } | 8331 | } |
8304 | \NewDocumentEnvironment{ekdstanza}{O{}}{% | 8332 | \NewDocumentEnvironment{ekdstanza}{!O{}}{% |
8333 | \leavevmode\unskip | ||
8305 | \ekvset{ekd@stanza}{#1}% | 8334 | \ekvset{ekd@stanza}{#1}% |
8335 | \ignorespaces | ||
8306 | }{} | 8336 | }{} |
8307 | % \end{macrocode} | 8337 | % \end{macrocode} |
8308 | % \end{environment} | 8338 | % \end{environment} |
@@ -8712,6 +8742,7 @@ local texpatttotags = { | |||
8712 | {a="\\resetvlinenumber%s+", b=""}, | 8742 | {a="\\resetvlinenumber%s+", b=""}, |
8713 | {a="\\resetlinenumber%s+%[(.-)%]", b=""}, | 8743 | {a="\\resetlinenumber%s+%[(.-)%]", b=""}, |
8714 | {a="\\resetlinenumber%s+", b=""}, | 8744 | {a="\\resetlinenumber%s+", b=""}, |
8745 | {a="\\indentpattern%s+{(.-)}", b=""}, | ||
8715 | {a="\\poemlines%s+{(.-)}", b=""}, | 8746 | {a="\\poemlines%s+{(.-)}", b=""}, |
8716 | {a="\\pagebreak%s+%[[1-4]%]", b=""}, | 8747 | {a="\\pagebreak%s+%[[1-4]%]", b=""}, |
8717 | {a="\\pagebreak%s+", b=""}, | 8748 | {a="\\pagebreak%s+", b=""}, |
@@ -8958,9 +8989,9 @@ local function linestotei(str) | |||
8958 | then | 8989 | then |
8959 | str = "\n<l>"..str | 8990 | str = "\n<l>"..str |
8960 | end | 8991 | end |
8961 | str = gsub(str, poemline * spcenc^-1 * bclinegroup, "</l>\n%2") | 8992 | str = gsub(str, poemline * spcenc^0 * bclinegroup, "</l>\n%2") |
8962 | str = gsub(str, linegroup * -(spcenc^-1 * bclinegroup), "%1\n<l>") | 8993 | str = gsub(str, linegroup * -(spcenc^0 * bclinegroup), "%1\n<l>a") |
8963 | str = gsub(str, lpeg.Cs("</lg>") * -(spcenc^-1 * (bclinegroup + -1)), "%1\n<l>") | 8994 | str = gsub(str, lpeg.Cs("</lg>") * -(spcenc^0 * (bclinegroup + -1)), "%1\n<l>") |
8964 | -- str = gsub(str, poemline * spcenc^-1 * -1, "</l>\n") | 8995 | -- str = gsub(str, poemline * spcenc^-1 * -1, "</l>\n") |
8965 | str = gsub(str, poemlinebreak, "<lb/> ") | 8996 | str = gsub(str, poemlinebreak, "<lb/> ") |
8966 | -- str = gsub(str, poemline * spcenc^-1 * lpeg.Cs("<lg"), "</l>%2") | 8997 | -- str = gsub(str, poemline * spcenc^-1 * lpeg.Cs("<lg"), "</l>%2") |
@@ -8991,6 +9022,9 @@ end | |||
8991 | 9022 | ||
8992 | -- better use lpeg: look into this later | 9023 | -- better use lpeg: look into this later |
8993 | local function versetotei(str) | 9024 | local function versetotei(str) |
9025 | str = string.gsub(str, "\\begin%s?%{patverse%}", "") | ||
9026 | str = string.gsub(str, "\\end%s?%{patverse%}", "") | ||
9027 | str = string.gsub(str, "\\indentpattern%s?%b{}", "") | ||
8994 | str = string.gsub(str, "\\begin%s?%{ekdverse%}(%b[])(.-)\\end%s?%{ekdverse%}", function(opt, arg) | 9028 | str = string.gsub(str, "\\begin%s?%{ekdverse%}(%b[])(.-)\\end%s?%{ekdverse%}", function(opt, arg) |
8995 | arg = string.gsub(arg, "\\par%s?", "") | 9029 | arg = string.gsub(arg, "\\par%s?", "") |
8996 | opt = string.sub(opt, 2, -2) | 9030 | opt = string.sub(opt, 2, -2) |