summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/poetry
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-05-01 22:51:20 +0000
committerKarl Berry <karl@freefriends.org>2019-05-01 22:51:20 +0000
commitd86e9513f58842b43460cb42d021a2e51fd5730d (patch)
treef42ac56a2c93f6087d3ecff6a60abd5f38eec99d /Master/texmf-dist/tex/latex/poetry
parentf1a25b968a0601f5866891e3e4b58f32cdd38f80 (diff)
poetry (1may19)
git-svn-id: svn://tug.org/texlive/trunk@50921 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/poetry')
-rw-r--r--Master/texmf-dist/tex/latex/poetry/poetry.sty131
1 files changed, 82 insertions, 49 deletions
diff --git a/Master/texmf-dist/tex/latex/poetry/poetry.sty b/Master/texmf-dist/tex/latex/poetry/poetry.sty
index 5f4c7b03c51..4dfbabeee65 100644
--- a/Master/texmf-dist/tex/latex/poetry/poetry.sty
+++ b/Master/texmf-dist/tex/latex/poetry/poetry.sty
@@ -13,7 +13,7 @@
%% conditions of that license. See
%% http://www.latex-project.org/lppl.txt
%% for the text of the license. This document is released
-%% under version 1.3 of that license, and this work may be distributed
+%% under version 1.3c of that license, and this work may be distributed
%% or modified under the terms of that license or, at your option, any
%% later version.
%%
@@ -26,13 +26,19 @@
%% derived files poetry.sty and poetry.pdf.
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
-\ProvidesPackage{poetry}[2018/09/10 v1.1 support for typesetting poetry]
+\ProvidesPackage{poetry}[2019/05/02 v2.0 support for typesetting poetry]
\ProvidesPackage{poetry}%
+\RequirePackage{modulus}%
\newcounter{poemline}%
\newcount\poemlineno%
+\newcounter{poemrtline}%
+\newcount\poemrtlineno%
+\renewcommand\thepoemrtline{}%
\newcounter{verseline}%
\newcount\vslineno%
+\newcounter{stanzacount}%
+\newcount\stanzano%
\newcounter{abspoemno}%
\newcount\poem@abspoemno%
\newcounter{poemno}%
@@ -41,6 +47,8 @@
\newcount\poem@groupno\poem@groupno=0%
\newcounter{poemlinenumsevery}\setcounter{poemlinenumsevery}{1}%
\newcount\poem@linenumsevery\poem@linenumsevery=\value{poemlinenumsevery}%
+\newcounter{poemrtlinenumsevery}\setcounter{poemrtlinenumsevery}{1}%
+\newcount\poem@rt@linenumsevery\poem@rt@linenumsevery=\value{poemrtlinenumsevery}%
\newlength{\poemindent}\setlength{\poemindent}{0pt}%
\newlength{\poemtopskip}{\setlength{\poemtopskip}{1em}%
\newlength{\poembotskip}{\setlength{\poembotskip}{1em}%
@@ -48,15 +56,34 @@
\newdimen\poem@defleftskip\poem@defleftskip=\the\poemindent%
\newdimen\poem@maxlinewd%
\newlength{\poemmaxlinewd}\setlength{\poemmaxlinewd}{\textwidth}%
+\newdimen\poem@rt@maxlinewd%
+\newlength{\poemrtmaxlinewd}\setlength{\poemrtmaxlinewd}{\textwidth}%
\newdimen\poem@hinwd\poem@hinwd=1em%
\newlength{\poemhinwd}\setlength{\poemhinwd}{1em}%
\newif\ifpoemlinenums\poemlinenumstrue%
-\newif\ifpoemlinenumright\poemlinenumrightfalse%
+\newif\ifpoemrtlinenums\poemrtlinenumstrue%
+\def\poemlinenumright{%
+\renewcommand{\thepoemrtline}{\arabic{poemline}}%
+\renewcommand{\thepoemline}{}%
+}%
+\def\poemlinenumrighttrue{%
+\renewcommand{\thepoemrtline}{\arabic{poemline}}%
+\renewcommand{\thepoemline}{}%
+}%
+\def\poemlinenumrightfalse{%
+\renewcommand{\thepoemline}{\arabic{poemline}}%
+\renewcommand{\thepoemrtline}{}%
+}%
\newdimen\poem@linenumboxwd\poem@linenumboxwd=2em%
\newlength{\poemlinenumboxwd}\setlength{\poemlinenumboxwd}{2em}%
+\newdimen\poem@rt@linenumboxwd\poem@rt@linenumboxwd=2em%
+\newlength{\poemrtlinenumboxwd}\setlength{\poemrtlinenumboxwd}{2em}%
\newdimen\poem@linenumboxgap\poem@linenumboxgap=0pt%
\newlength{\poemlinenumboxgap}\setlength{\poemlinenumboxgap}{0pt}%
+\newdimen\poem@rt@linenumboxgap\poem@rt@linenumboxgap=0pt%
+\newlength{\poemrtlinenumboxgap}\setlength{\poemrtlinenumboxgap}{0pt}%
\def\poemlinenumstyle{}%
+\def\poemrtlinenumstyle{}%
\newdimen\poem@hangindent\poem@hangindent=1em%
\newlength{\poemhangindent}\setlength{\poemhangindent}{1em}%
\newcount\poem@indentevery\poem@indentevery=0%
@@ -65,12 +92,12 @@
\newlength{\poemverseskip}\setlength{\poemverseskip}{\baselineskip}%
\newdimen\poem@buff%
\newcount\poem@tmp%
+\def\loopcommand{\hin}%
\def\poem@expandvsloop#1{\poem@xvsloop#1\relax}%
\def\poem@xvsloop#1{%
\ifx\relax#1\else%
-\poem@tmp=#1%
-\ifnum\poem@tmp=\the\vslineno%
-\hin%
+\ifnum#1=\the\vslineno%
+\loopcommand\relax%
\fi%
\expandafter\poem@xvsloop%
\fi%
@@ -79,39 +106,47 @@
\newcommand{\poem@ifhyph}[1]{\@ifnextchar -{\@firstoftwo{#1}}}
\newcommand{\poem@ifstar}[1]{\@ifnextchar *{\@firstoftwo{#1}}}
\newcommand{\poem@ifques}[1]{\@ifnextchar ?{\@firstoftwo{#1}}}
-\newcount\poem@tmpa
-\def\modulo#1#2{%
-\poem@tmpa=#1%
-\divide\poem@tmpa by#2%
-\multiply\poem@tmpa by#2%
-\multiply\poem@tmpa by-1%
-\advance\poem@tmpa by#1\relax%
-}%
\def\poemvsindentlines{}%
-\def\poemlnindentlines{}%
+\def\poemnumlines{}%
+\def\poemrtnumlines{}%
\def\tlap#1{\vbox to0pt{\vss\hbox{#1}}}%
\def\blap#1{\vbox to0pt{\hbox{#1}\vss}}%
\def\placelineno{%
\setcounter{verseline}{\the\vslineno}%
\setcounter{poemline}{\the\poemlineno}%
+\setcounter{stanzacount}{\the\stanzano}%
+\setcounter{poemrtline}{\the\poemrtlineno}%
\poem@linenumsevery=\value{poemlinenumsevery}%
+\poem@rt@linenumsevery=\value{poemrtlinenumsevery}%
+\poem@indentevery=\value{poemindentevery}%
\poem@linenumboxgap=\the\poemlinenumboxgap%
\poem@linenumboxwd=\the\poemlinenumboxwd%
-\modulo{\the\poemlineno}{\the\poem@linenumsevery}%
+\poem@rt@linenumboxgap=\the\poemrtlinenumboxgap%
+\poem@rt@linenumboxwd=\the\poemrtlinenumboxwd%
\ifpoemlinenums%
-\ifnum\poem@tmpa=0%
-\ifpoemlinenumright%
-\hskip0pt\tlap{%
-\rlap{%
-\hskip\poem@maxlinewd%
-\hskip\poem@linenumboxgap%
-\hbox to\poem@linenumboxwd{%
-\hfil%
-\poemlinenumstyle\thepoemline%
-}%
-}%
+\def\loopcommand{\poem@putlineno}%
+\expandafter\poem@expandvsloop\expandafter{\poemnumlines}%
+\def\loopcommand{\poem@rt@putlineno}%
+\expandafter\poem@expandvsloop\expandafter{\poemrtnumlines}%
+\ifnum\poem@linenumsevery=0\relax\else%
+\modulo{\the\vslineno}{\the\poem@linenumsevery}%
+\ifnum\remainder=0\poem@putlineno\fi%
+\fi%
+\ifnum\poem@rt@linenumsevery=0\relax\else%
+\modulo{\the\vslineno}{\the\poem@rt@linenumsevery}%
+\ifnum\remainder=0\poem@rt@putlineno\fi%
+\fi%
+\fi%
+\ifnum\poem@indentevery=0\relax\else%
+\modulo{\the\vslineno}{\the\poem@indentevery}%
+\ifnum\remainder=0\hin\fi%
+\fi%
+\def\loopcommand{\hin}%
+\expandafter\poem@expandvsloop\expandafter{\poemvsindentlines}%
+\def\@currentlabel{\thepoemline}%
+\phantomsection%
}%
-\else%
+\def\poem@putlineno{%
\hskip-\poem@linenumboxgap%
\llap{%
\tlap{%
@@ -120,30 +155,26 @@
\hfil%
}\penalty10000%
}%
-}\penalty10000%
+}%
+\ifnum\poemlineno=1\relax\else%
+\ifnum\vslineno=1%
+\vskip-\baselineskip%
\fi%
-\else
-\hskip-\poem@linenumboxgap%
-\llap{\tlap{\hbox to\poem@linenumboxwd{\hfil}}}%
-\penalty10000%
\fi%
-\else
-\hskip-\poem@linenumboxgap%
-\llap{\tlap{\hbox to\poem@linenumboxwd{\hfil}}}%
\penalty10000%
-\fi%
-\par\vskip-\baselineskip%
-\poem@indentevery=\value{poemindentevery}%
-\ifnum\poem@indentevery=0%
-\else%
-\modulo{\the\poemlineno}{\the\poem@indentevery}%
-\ifnum\poem@tmpa=0%
-\hin%
-\fi%
-\fi%
-\expandafter\poem@expandvsloop\expandafter{\poemvsindentlines}%
-\def\@currentlabel{\thepoemline}%
-\phantomsection%
+}%
+\def\poem@rt@putlineno{%
+\hskip0pt\tlap{%
+\rlap{%
+\hskip\poem@maxlinewd%
+\hskip\poem@rt@linenumboxgap%
+\hbox to\poem@rt@linenumboxwd{%
+\hfil%
+\poemrtlinenumstyle\thepoemrtline%
+}%
+}%
+}%
+\vskip-\baselineskip%
}%
\def\poem@endline{%
\par%
@@ -170,6 +201,7 @@
\par%
\vslineno=1%
\advance\poemlineno by1%
+\advance\stanzano by1%
\poem@verseskip=\the\poemverseskip%
\vskip\poem@verseskip%
\leftskip=\poem@defleftskip%
@@ -217,6 +249,7 @@
\advance\hsize by\the\poem@maxlinewd%
\poemlineno=1%
\vslineno=1%
+\stanzano=1%
\poem@topskip=\the\poemtopskip%
\poem@botskip=\the\poembotskip%
\vskip\poem@topskip%