summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
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/source
parentf1a25b968a0601f5866891e3e4b58f32cdd38f80 (diff)
poetry (1may19)
git-svn-id: svn://tug.org/texlive/trunk@50921 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/poetry/poetry.dtx331
-rw-r--r--Master/texmf-dist/source/latex/poetry/poetry.ins4
2 files changed, 264 insertions, 71 deletions
diff --git a/Master/texmf-dist/source/latex/poetry/poetry.dtx b/Master/texmf-dist/source/latex/poetry/poetry.dtx
index 49ad9a81308..de710f32393 100644
--- a/Master/texmf-dist/source/latex/poetry/poetry.dtx
+++ b/Master/texmf-dist/source/latex/poetry/poetry.dtx
@@ -1,7 +1,7 @@
% \iffalse
% +AMDG
%
-% This document is copyright 2018 by Donald P. Goodman, and is
+% This document is copyright 2019 by Donald P. Goodman, and is
% released publicly under the LaTeX Project Public License. The
% distribution and modification of this work is constrained by the
% conditions of that license. See
@@ -22,7 +22,7 @@
% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
-%<package>\ProvidesPackage{poetry}[2018/09/10 v1.1 support for typesetting poetry]
+%<package>\ProvidesPackage{poetry}[2019/05/02 v2.0 support for typesetting poetry]
%<*driver>
\documentclass{ltxdoc}
@@ -77,7 +77,7 @@
%</driver>
% \fi
%
-% \title{The |poetry| Package, v1.1}
+% \title{The |poetry| Package, v2.0}
% \author{Donald P.\ Goodman III}
% \date{\today}
%
@@ -262,7 +262,7 @@
% that governs how far the poem will be indented from the
% left margin. Reset it as usual with \LaTeX's |\setlength|
% command; e.g., |\setlength{\poemindent}{1.5in}| to indent
-% the entire poem 1.5in from the left line. By default,
+% the entire poem 1.5in from the left margin. By default,
% |\poemindent| is |0pt|, meaning that verses are flush with
% the left margin. This also means that line numbers, if
% they are on the left, will hang into the left margin.
@@ -549,6 +549,7 @@
% The port is near, the bells I hear, the people all exulting, \\
% While follow eyes the steady keel, the vessel grim and daring; \\-
% \end{poem}
+% \setcounter{poemlinenumsevery}{0}
%
% This can, of course, be set to any value, though typically
% 1--4 are reasonable ones. A sufficiently high number will
@@ -557,17 +558,61 @@
% last line number was. But I'm certainly not going to make
% it impossible.
%
-% Line numbers can be placed on either the right or the
-% left. By default, they are placed on the left; to place
-% them on the right, use
+% Often, though, you won't want to print line numbers every
+% arbitrary number of lines throughout the poem, but on
+% certain lines by verse. E.g., perhaps you want to number
+% lines 2, 3, and 5 of a poem, but not 1, 4, and 6. To
+% accomplish this, use the \DescribeMacro{\poemnumlines}|\poemnumlines|
+% macro. If empty, it has no effect, and by default it is
+% empty. However, if you put in a list of numbers,
+% then the lines of each stanza corresponding to that list
+% of numbers will be numbered accordingly. So, for example,
+% to number 2, 3, and 5 only:
+%
+% \begin{verbatim}
+% \def\poemnumlines{235}
+% \begin{poem}
+% Once upon a midnight dreary, while I pondered, weak and weary,\\
+% Over many a quaint and curious volume of forgotten lore---\\
+% While I nodded, nearly napping, suddenly there came a tapping,\\
+% As of someone gently rapping, rapping at my chamber door.\\
+% ``'Tis some visitor,'' I muttered, ``tapping at my chamber door---\\
+% Only this and nothing more.''\\-
+% \end{poem}
+% \def\poemnumlines{}
+% \end{verbatim}
+%
+% Yields the following:
+% \def\poemnumlines{235}
+% \begin{poem}
+% Once upon a midnight dreary, while I pondered, weak and weary,\\
+% Over many a quaint and curious volume of forgotten lore---\\
+% While I nodded, nearly napping, suddenly there came a tapping,\\
+% As of someone gently rapping, rapping at my chamber door.\\
+% ``'Tis some visitor,'' I muttered, ``tapping at my chamber door---\\
+% Only this and nothing more.''\\-
+% \end{poem}
+% \def\poemnumlines{}
+%
+% This pattern will repeat for each verse until you set
+% |\poemnumline| to something else.
+%
+% Finally, line numbers can be placed on either the right or the
+% left. |poetry| v2.0 introduces significantly more
+% flexibility into this mechanic; however, to preserve
+% backward compatibility, the old commands are still
+% recognized. To place line numbers on the right, use
% \DescribeMacro{\poemlinenumrighttrue}|\poemlinenumrighttrue|;
% to put them back on the left, use the corresponding
% command
% \DescribeMacro{\poemlinenumrightfalse}|\poemlinenumrightfalse|.
+% Note that these commands merely set the right-hand line
+% number spot to equal the poem line counter; this will make
+% sense to you later.
%
% \begin{verbatim}
-% \setcounter{poemlinenumsevery}{1}
% \poemlinenumrighttrue
+% \setcounter{poemlinenumsevery}{1}
% \begin{poem}
% O captain! my captain! The fearful trip is done; \\
% \poemlinenumrightfalse
@@ -580,8 +625,8 @@
% Which gives us this (notice that right-side line numbers
% are placed after |\poemmaxlinewd|):
%
-% \setcounter{poemlinenumsevery}{1}
% \poemlinenumrighttrue
+% \setcounter{poemlinenumsevery}{1}
% \begin{poem}
% O captain! my captain! The fearful trip is done; \\
% \poemlinenumrightfalse
@@ -600,6 +645,112 @@
% line. Please keep that in mind when you're planning your
% formats.
%
+% As of v2.0, |poetry| allows numbering to appearing on both
+% the right \emph{and} left side of the poem. This is a
+% much more flexible mechanism than before, and should be
+% used in preference to the old |\poemlinenumsrighttrue|
+% mechanism in any new work.
+%
+% Any of the line numbering variables beginning with |\poem|
+% have corresponding versions beginning with |\poemrt|. You
+% can then set the variables arbitrarily for the left and
+% right sides, which will not effect one another.
+% E.g., perhaps you want to show total line numbers on the
+% left, and verse line numbers on the right, both on every
+% two lines:
+%
+% \begin{quote}
+% |\renewcommand{\thepoemline}{\arabic{poemline}}|\\
+% |\setcounter{poemlinenumsevery}{2}|\\
+% |\setcounter{poemrtlinenumsevery}{2}|\\
+% |\renewcommand{\thepoemrtline}{\arabic{verseline}}|\\
+% \end{quote}
+%
+% \renewcommand{\thepoemline}{\arabic{poemline}}
+% \setcounter{poemlinenumsevery}{2}
+% \setcounter{poemrtlinenumsevery}{2}
+% \renewcommand{\thepoemrtline}{\arabic{verseline}}
+% \centerpoemon{Whose woods these are I think I know.}
+% \begin{poem}
+% Whose woods these are I think I know. \\
+% His house is in the village though; \\
+% He will not see me stopping here \\
+% To watch his woods fill up with snow. \\!
+%
+% My little horse must think it queer \\
+% To stop without a farmhouse near \\
+% Between the woods and frozen lake \\
+% The darkest evening of the year. \\-
+% \end{poem}
+% \setcounter{poemlinenumsevery}{0}
+% \setcounter{poemrtlinenumsevery}{0}
+%
+% This is useful for those volumes that wish to list a
+% stanza number as well as a line numbers, one on each side.
+% |poetry| offers the stanza number as the counter
+% \DescribeMacro{stanzacount}|stanzacount|. For example, to
+% put the line count on the right, with a stanza count on the
+% first line of each stanza on the left:
+%
+% \begin{quote}
+% |\def\poemnumlines{1}|\\
+% |\renewcommand{\thepoemline}{\arabic{stanzacount}}|\\
+% |\setcounter{poemrtlinenumsevery}{1}|\\
+% |\renewcommand{\thepoemrtline}{\arabic{poemline}}|\\
+% \end{quote}
+%
+% \def\poemnumlines{1}
+% \renewcommand{\thepoemline}{\arabic{stanzacount}}
+% \setcounter{poemrtlinenumsevery}{1}
+% \renewcommand{\thepoemrtline}{\arabic{poemline}}
+% \centerpoemon{Whose woods these are I think I know.}
+% \begin{poem}
+% Whose woods these are I think I know. \\
+% His house is in the village though; \\
+% He will not see me stopping here \\
+% To watch his woods fill up with snow. \\!
+%
+% My little horse must think it queer \\
+% To stop without a farmhouse near \\
+% Between the woods and frozen lake \\
+% The darkest evening of the year. \\-
+% \end{poem}
+%
+% We can occasionally do some truly interesting things this
+% way. For example, to have odd-numbered lines marked on
+% the left and even on the right:
+%
+% \begin{quote}
+% |\renewcommand{\thepoemline}{\arabic{poemline}}|\\
+% |\renewcommand{\thepoemrtline}{\arabic{poemline}}|\\
+% |\def\poemnumlines{13}|\\
+% |\def\poemrtnumlines{24}|\\
+% \end{quote}
+%
+% \setcounter{poemlinenumsevery}{99}
+% \setcounter{poemrtlinenumsevery}{99}
+% \renewcommand{\thepoemline}{\arabic{poemline}}
+% \renewcommand{\thepoemrtline}{\arabic{poemline}}
+% \def\poemnumlines{13}
+% \def\poemrtnumlines{24}
+% \centerpoemon{Whose woods these are I think I know.}
+% \begin{poem}
+% Whose woods these are I think I know. \\
+% His house is in the village though; \\
+% He will not see me stopping here \\
+% To watch his woods fill up with snow. \\!
+%
+% My little horse must think it queer \\
+% To stop without a farmhouse near \\
+% Between the woods and frozen lake \\
+% The darkest evening of the year. \\!
+%
+% He gives his harness bells a shake \\
+% To ask if there is some mistake. \\
+% The only other sound's the sweep \\
+% Of easy wind and downy flake. \\-
+% \end{poem}
+%
% \subsubsection{Styling Line Numbers}
% \label{subsub:stylelineno}
%
@@ -642,7 +793,7 @@
% \poemlinenumrighttrue
% \begin{poem}
% And gentlemen in England now abed \\
-% \setlength{\poemlinenumboxwd}{1em}
+% \setlength{\poemrtlinenumboxwd}{1em}
% shall think themselves accurs'd they were not here, \\
% and hold their manhoods cheap whilst any speaks \\
% that fought with us, upon St.~Crispin's day. \\-
@@ -655,11 +806,16 @@
% but a different way when you use them elsehwere, you can
% use \DescribeMacro{\poemlinenumstyle}|\poemlinenumstyle|
% to change their appearance. For example, the following
-% uses |\def\poemlinenumstyle{\footnotesize\color{green}}|:
+% uses |\def\poemlinenumstyle{\footnotesize\color{green}}|
+% and |\def\poemrtlinenumstyle{\LARGE\color{red}}|:
%
% \centerpoemon{Thou see'st the world, Volumnius, how it goes; }
-% \poemlinenumrightfalse
+% \renewcommand{\thepoemline}{\arabic{poemline}}
+% \renewcommand{\thepoemrtline}{\arabic{poemline}}
+% \def\poemnumlines{13}
+% \def\poemrtnumlines{24}
% \def\poemlinenumstyle{\footnotesize\color{green}}
+% \def\poemrtlinenumstyle{\LARGE\color{red}}
% \begin{poem}
% Thou see'st the world, Volumnius, how it goes; \\
% our enemies have beat us to the pit. \\
@@ -667,8 +823,12 @@
% than tarry till they push us. \\-
% \end{poem}
%
-% By default, |\poemlinenumstyle| does nothing.
+% The right line style is an insane choice; but it does
+% demonstrate how things work. By default, both
+% |\poemlinenumstyle| and |\poemrtlinenumstyle| do nothing.
% \def\poemlinenumstyle{}
+% \def\poemrtlinenumstyle{}
+% \def\poemrtnumlines{}
%
% Labels can be placed on any line of poetry, and refer back
% to that line. Make references with the usual \LaTeX\
@@ -678,6 +838,7 @@
% |hyperref|, these will correctly turn into hyperlinks, as
% well.
%
+%
% \section{Document Structure}
% \label{sect:structure}
%
@@ -1154,10 +1315,16 @@
%
% \begin{macrocode}
\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}%
@@ -1166,6 +1333,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}%
@@ -1173,15 +1342,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%
@@ -1190,17 +1378,17 @@
\newlength{\poemverseskip}\setlength{\poemverseskip}{\baselineskip}%
\newdimen\poem@buff%
\newcount\poem@tmp%
-% from David Carlisle's answer on tex.stackexchange.com,
+% From David Carlisle's answer on tex.stackexchange.com,
% question 57598; allows us to loop through a string in a
% command. We will use this for the verse indentation
% counter, as well as for the generic line indentatin
-% counter, both in |\placelineno|.
+% counter and the right indentation counter, both in |\placelineno|.
+\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%
@@ -1210,73 +1398,76 @@
\newcommand{\poem@ifhyph}[1]{\@ifnextchar -{\@firstoftwo{#1}}}
\newcommand{\poem@ifstar}[1]{\@ifnextchar *{\@firstoftwo{#1}}}
\newcommand{\poem@ifques}[1]{\@ifnextchar ?{\@firstoftwo{#1}}}
-% get modulus
-\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%
- }%
- }%
- }%
- \else%
- \hskip-\poem@linenumboxgap%
- \llap{%
- \tlap{%
- \hbox to\poem@linenumboxwd{%
- \poemlinenumstyle\thepoemline%
- \hfil%
- }\penalty10000%
- }%
- }\penalty10000%
- \fi%
- \else
- \hskip-\poem@linenumboxgap%
- \llap{\tlap{\hbox to\poem@linenumboxwd{\hfil}}}%
- \penalty10000%
+ \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%
- \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%
+ \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%
}%
+\def\poem@putlineno{%
+ \hskip-\poem@linenumboxgap%
+ \llap{%
+ \tlap{%
+ \hbox to\poem@linenumboxwd{%
+ \poemlinenumstyle\thepoemline%
+ \hfil%
+ }\penalty10000%
+ }%
+ }%
+ \ifnum\poemlineno=1\relax\else%
+ \ifnum\vslineno=1%
+ \vskip-\baselineskip%
+ \fi%
+ \fi%
+ \penalty10000%
+}%
+\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%
\advance\poemlineno by1%
@@ -1302,6 +1493,7 @@
\par%
\vslineno=1%
\advance\poemlineno by1%
+ \advance\stanzano by1%
\poem@verseskip=\the\poemverseskip%
\vskip\poem@verseskip%
\leftskip=\poem@defleftskip%
@@ -1349,6 +1541,7 @@
\advance\hsize by\the\poem@maxlinewd%
\poemlineno=1%
\vslineno=1%
+ \stanzano=1%
\poem@topskip=\the\poemtopskip%
\poem@botskip=\the\poembotskip%
\vskip\poem@topskip%
diff --git a/Master/texmf-dist/source/latex/poetry/poetry.ins b/Master/texmf-dist/source/latex/poetry/poetry.ins
index 1ed29aa55c2..ecc4db043fe 100644
--- a/Master/texmf-dist/source/latex/poetry/poetry.ins
+++ b/Master/texmf-dist/source/latex/poetry/poetry.ins
@@ -3,7 +3,7 @@
% Apostle, and the Immaculate Heart of Mary, for their
% prayers, and to the Sacred Heart of Jesus, for His mercy.
%
-% This document is copyright 2018 by Donald P. Goodman, and is
+% This document is copyright 2019 by Donald P. Goodman, and is
% released publicly under the LaTeX Project Public License. The
% distribution and modification of this work is constrained by the
% conditions of that license. See
@@ -32,7 +32,7 @@ distribution and modification of this work is constrained by the
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.