Debian Codegraph @

texmf-dist/source/latex/verse/verse.dtx

raw
1 % \iffalse meta-comment
2 %
3 % verse.dtx
4 % Author: Peter Wilson
5 % Maintainer: Will Robertson (will dot robertson at latex-project dot org)
6 % Herries Press
7 % Copyright 2001--2007 Peter R. Wilson
8 %
9 % This work may be distributed and/or modified under the
10 % conditions of the LaTeX Project Public License, either
11 % version 1.3c of this license or (at your option) any
12 % later version: <http://www.latex-project.org/lppl.txt>
13 %
14 % This work has the LPPL maintenance status "maintained".
15 % The Current Maintainer of this work is Will Robertson.
16 %
17 % This work consists of the files listed in the README file.
18 %
19 %<*driver>
20 \documentclass[twoside]{ltxdoc}
21 \usepackage{alltt}
22 \usepackage{verse}
23 \usepackage{xcolor}
24 \usepackage[draft=false,
25 plainpages=false,
26 pdfpagelabels,
27 bookmarksnumbered,
28 hyperindex=false
29 ]{hyperref}
30 \usepackage{listings}
31 \lstset{
32 basicstyle=\small\ttfamily,
33 columns=fullflexible,
34 backgroundcolor=\color[rgb]{0.97,0.97,1},
35 gobble=2,
36 }
37 \newsavebox\ltxbox
38 \newenvironment{ltxoutput*}
39 {\fboxsep=0pt\noindent\begin{lrbox}{\ltxbox}\begin{minipage}{\textwidth}}
40 {\end{minipage}\end{lrbox}\begin{center}\colorbox[rgb]{0.97,1,0.97}{\usebox\ltxbox\par}\end{center}}
41 \newenvironment{ltxoutput}
42 {\par\begin{ltxoutput*}}
43 {\end{ltxoutput*}}
44
45 \providecommand{\phantomsection}
46 \show\makeatletter
47 \makeatletter
48 \@mparswitchfalse
49 \makeatother
50 \renewcommand{\MakeUppercase}[1]{#1}
51 \pagestyle{headings}
52 \EnableCrossrefs
53 \CodelineIndex
54 %%\OnlyDescription
55 \setcounter{StandardModuleDepth}{1}
56 \begin{document}
57 \DocInput{verse.dtx}
58 \end{document}
59 %</driver>
60 %
61 % \fi
62 %
63 % \CheckSum{553}
64 %
65 % \DoNotIndex{\',\.,\@M,\@@input,\@addtoreset,\@arabic,\@badmath}
66 % \DoNotIndex{\@centercr,\@cite}
67 % \DoNotIndex{\@dotsep,\@empty,\@float,\@gobble,\@gobbletwo,\@ignoretrue}
68 % \DoNotIndex{\@input,\@ixpt,\@m}
69 % \DoNotIndex{\@minus,\@mkboth,\@ne,\@nil,\@nomath,\@plus,\@set@topoint}
70 % \DoNotIndex{\@tempboxa,\@tempcnta,\@tempdima,\@tempdimb}
71 % \DoNotIndex{\@tempswafalse,\@tempswatrue,\@viipt,\@viiipt,\@vipt}
72 % \DoNotIndex{\@vpt,\@warning,\@xiipt,\@xipt,\@xivpt,\@xpt,\@xviipt}
73 % \DoNotIndex{\@xxpt,\@xxvpt,\\,\ ,\addpenalty,\addtolength,\addvspace}
74 % \DoNotIndex{\advance,\Alph,\alph}
75 % \DoNotIndex{\arabic,\ast,\begin,\begingroup,\bfseries,\bgroup,\box}
76 % \DoNotIndex{\bullet}
77 % \DoNotIndex{\cdot,\cite,\CodelineIndex,\cr,\day,\DeclareOption}
78 % \DoNotIndex{\def,\DisableCrossrefs,\divide,\DocInput,\documentclass}
79 % \DoNotIndex{\DoNotIndex,\egroup,\ifdim,\else,\fi,\em,\endtrivlist}
80 % \DoNotIndex{\EnableCrossrefs,\end,\end@dblfloat,\end@float,\endgroup}
81 % \DoNotIndex{\endlist,\everycr,\everypar,\ExecuteOptions,\expandafter}
82 % \DoNotIndex{\fbox}
83 % \DoNotIndex{\filedate,\filename,\fileversion,\fontsize,\framebox,\gdef}
84 % \DoNotIndex{\global,\halign,\hangindent,\hbox,\hfil,\hfill,\hrule}
85 % \DoNotIndex{\hsize,\hskip,\hspace,\hss,\if@tempswa,\ifcase,\or,\fi,\fi}
86 % \DoNotIndex{\ifhmode,\ifvmode,\ifnum,\iftrue,\ifx,\fi,\fi,\fi,\fi,\fi}
87 % \DoNotIndex{\input}
88 % \DoNotIndex{\jobname,\kern,\leavevmode,\let,\leftmark}
89 % \DoNotIndex{\list,\llap,\long,\m@ne,\m@th,\mark,\markboth,\markright}
90 % \DoNotIndex{\month,\newcommand,\newcounter,\newenvironment}
91 % \DoNotIndex{\NeedsTeXFormat,\newdimen}
92 % \DoNotIndex{\newlength,\newpage,\nobreak,\noindent,\null,\number}
93 % \DoNotIndex{\numberline,\OldMakeindex,\OnlyDescription,\p@}
94 % \DoNotIndex{\pagestyle,\par,\paragraph,\paragraphmark,\parfillskip}
95 % \DoNotIndex{\penalty,\PrintChanges,\PrintIndex,\ProcessOptions}
96 % \DoNotIndex{\protect,\ProvidesClass,\raggedbottom,\raggedright}
97 % \DoNotIndex{\refstepcounter,\relax,\renewcommand,\reset@font}
98 % \DoNotIndex{\rightmargin,\rightmark,\rightskip,\rlap,\rmfamily,\roman}
99 % \DoNotIndex{\roman,\secdef,\selectfont,\setbox,\setcounter,\setlength}
100 % \DoNotIndex{\settowidth,\sfcode,\skip,\sloppy,\slshape,\space}
101 % \DoNotIndex{\symbol,\the,\trivlist,\typeout,\tw@,\undefined,\uppercase}
102 % \DoNotIndex{\usecounter,\usefont,\usepackage,\vfil,\vfill,\viiipt}
103 % \DoNotIndex{\viipt,\vipt,\vskip,\vspace}
104 % \DoNotIndex{\wd,\xiipt,\year,\z@}
105 %
106 % \changes{v1.0}{2001/07/21}{First public release}
107 % \changes{v1.1}{2001/08/03}{Added patterns for line indents}
108 % \changes{v1.2}{2001/10/28}{Minor change in verse environment}
109 % \changes{v2.0}{2002/03/24}{Added numbering}
110 % \changes{v2.1}{2002/03/28}{Added shorthands for linebreak and end of stanza}
111 % \changes{v2.2}{2002/07/18}{Added interstanza spacing}
112 % \changes{v2.21}{2004/03/21}{Made compatible with hangul package}
113 % \changes{v2.22}{2005/08/22}{Made compatible with hyperref package}
114 % \changes{v2.3}{2006/01/14}{Added switch for linenumber side}
115 % \changes{v2.4}{2007/01/10}{Added code to start numbering at a given line}
116 % \changes{v2.4a}{2009/09/04}{New maintainer (Will Robertson)}
117 % \changes{v2.4b}{2014/05/10}{Documentation updates}
118 % \changes{v2.4c}{2024/02/11}{Avoid clash with tagging}
119 %
120 % \def\dtxfile{verse.dtx}
121 % ^^A \def\fileversion{v1.0}
122 % ^^A \def\filedate{2001/07/21}
123 % ^^A \def\fileversion{v1.1}
124 % ^^A \def\filedate{2001/08/03}
125 % ^^A \def\fileversion{v1.2}
126 % ^^A \def\filedate{2001/10/28}
127 % ^^A \def\fileversion{v2.0}
128 % ^^A \def\filedate{2002/03/24}
129 % \def\fileversion{v2.1} \def\filedate{2002/03/28}
130 % \def\fileversion{v2.2} \def\filedate{2002/07/18}
131 % \def\fileversion{v2.21} \def\filedate{2004/03/21}
132 % \def\fileversion{v2.22} \def\filedate{2005/08/22}
133 % \def\fileversion{v2.3} \def\filedate{2006/01/14}
134 % \def\fileversion{v2.4} \def\filedate{2007/01/10}
135 % \def\fileversion{v2.4a} \def\filedate{2009/09/04}
136 % \def\fileversion{v2.4b} \def\filedate{2014/05/10}
137 % \def\fileversion{v2.4c} \def\filedate{2024/02/12}
138 % \newcommand*{\Lpack}[1]{\textsf {#1}} ^^A typeset a package
139 % \newcommand*{\Lopt}[1]{\textsf {#1}} ^^A typeset an option
140 % \newcommand*{\file}[1]{\texttt {#1}} ^^A typeset a file
141 % \newcommand*{\Lcount}[1]{\textsl {\small#1}} ^^A typeset a counter
142 % \newcommand*{\pstyle}[1]{\textsl {#1}} ^^A typeset a pagestyle
143 % \newcommand*{\Lenv}[1]{\texttt {#1}} ^^A typeset an environment
144 % \newcommand*{\ablankline}{\vspace{\baselineskip}}
145 %
146 % \title{Typesetting simple verse with \LaTeX}
147 %
148 % \author{
149 % Author: Peter Wilson, Herries Press \\
150 % Maintainer: Will Robertson \\
151 % \large
152 % \texttt{http://github.com/wspr/herries-press/}
153 % }
154 % \date{\fileversion\qquad\filedate}
155 % \maketitle
156 % \begin{abstract}
157 % The \Lpack{verse} package provides some aids for the typesetting
158 % of simple verse.
159 %
160 % \end{abstract}
161 % \tableofcontents
162 %
163 %
164 %
165 % \section{Introduction}
166 %
167 % The typesetting of a poem should be really be dependent on the
168 % particular poem. Individual problems do not usually admit of a
169 % general solution, so this document and code should be used more
170 % as a guide towards some solutions rather than providing a ready
171 % made solution for any particular piece of verse.
172 %
173 % This manual is typeset according to the conventions of the
174 % \LaTeX{} \textsc{docstrip} utility which enables the automatic
175 % extraction of the \LaTeX{} macro source files~\cite{GOOSSENS94}.
176 %
177 % Section~\ref{sec:usc} describes the usage of the \Lpack{verse}
178 % package and
179 % commented source code is in Section~\ref{sec:code}.
180 % Colour is used to indicate input and output material; a \colorbox[rgb]{0.97,0.97,1}{blue} background indicates \LaTeX\ input source, and a \colorbox[rgb]{0.97,1,0.97}{green} background shows the corresponding output one should expect.
181 %
182 % The doggerel used as illustrative material has been taken
183 % from~\cite{RUMOUR}.
184 %
185 % \section{Verses in \LaTeX\ \emph{without} this package}
186 %
187 % LaTeX provides the |verse| environment which is defined as a particular
188 % kind of list. Within the environment you use |\\| to end a line
189 % and a blank line will end a stanza. For example, here is a single
190 % stanza poem:
191 % \begin{lstlisting}
192 % \newcommand{\garden}{
193 % I used to love my garden \\
194 % But now my love is dead \\
195 % For I found a bachelor's button \\
196 % In black-eyed Susan's bed.
197 % }
198 % \end{lstlisting}
199 % \newcommand{\garden}{
200 % I used to love my garden \\
201 % But now my love is dead \\
202 % For I found a bachelor's button \\
203 % In black-eyed Susan's bed.
204 % }
205 % When this is typeset as a normal LaTeX paragraph (with no paragraph
206 % indentation) it looks like:
207 % \begin{ltxoutput}
208 % \garden{}
209 % \end{ltxoutput}
210 % Typesetting it within \LaTeX's |verse| environment produces:
211 % \begin{ltxoutput}
212 % \begin{verse}
213 % \garden
214 % \end{verse}
215 % \end{ltxoutput}
216 % The stanza could also be typeset within the |alltt| environment, defined
217 % in the standard \Lpack{alltt} package, using a normal font and no |\\|
218 % line endings.
219 % \begin{lstlisting}
220 % \begin{alltt}\normalfont
221 % I used to love my garden
222 % But now my love is dead
223 % For I found a bachelor's button
224 % In black-eyed Susan's bed.
225 % \end{alltt}\end{lstlisting}
226 % which produces:
227 % \begin{ltxoutput}
228 % \begin{alltt}\catcode\%=9
229 %\normalfont
230 %I used to love my garden
231 %But now my love is dead
232 %For I found a bachelor's button
233 %In black-eyed Susan's bed.
234 % \end{alltt}
235 % \end{ltxoutput}
236 % The |alltt| environment is like the |verbatim| environment except that
237 % you can use LaTeX macros inside it.
238 %
239 % In the |verse| environment long lines will be wrapped and indented
240 % but in the |alltt| environment there is no indentation.
241 %
242 % Some stanzas have certain lines indented, often alternate ones. To
243 % typeset stanzas like this you have to add your own spacing. For
244 % instance:
245 % \begin{lstlisting}
246 % \begin{verse}
247 % There was an old party of Lyme \\
248 % Who married three wives at one time. \\
249 % \hspace{2em} When asked: `Why the third?' \\
250 % \hspace{2em} He replied: `One's absurd, \\
251 % And bigamy, sir, is a crime.'
252 % \end{verse}
253 % \end{lstlisting}
254 % will be typeset in a verse environment as:
255 % \begin{ltxoutput}
256 % \begin{verse}
257 % There was an old party of Lyme \\
258 % Who married three wives at one time. \\
259 % \hspace{2em} When asked: `Why the third?' \\
260 % \hspace{2em} He replied: `One's absurd, \\
261 % And bigamy, sir, is a crime.'
262 % \end{verse}
263 % \end{ltxoutput}
264 % Using the |alltt| environment you can put in the spacing via ordinary
265 % spaces. That is, this
266 % \begin{lstlisting}
267 % \begin{alltt}\normalfont
268 % There was an old party of Lyme
269 % Who married three wives at one time.
270 % When asked: `Why the third?'
271 % He replied: `One's absurd,
272 % And bigamy, sir, is a crime.'
273 % \end{alltt}
274 % \end{lstlisting}
275 % is typeset as
276 % \begin{ltxoutput}
277 % \begin{alltt}\catcode\%=9\normalfont
278 %There was an old party of Lyme
279 %Who married three wives at one time.
280 % When asked: `Why the third?'
281 % He replied: `One's absurd,
282 %And bigamy, sir, is a crime.'
283 % \end{alltt}
284 % \end{ltxoutput}
285 %
286 % More exotically you could use the TeX |\parshape| command:
287 % \begin{lstlisting}
288 % \parshape = 5 0pt \linewidth 0pt \linewidth
289 % 2em \linewidth 2em \linewidth 0pt \linewidth
290 % \noindent There was an old party of Lyme \\
291 % Who married three wives at one time. \\
292 % When asked: `Why the third?' \\
293 % He replied: `One's absurd, \\
294 % And bigamy, sir, is a crime.' \par
295 % \end{lstlisting}
296 % which will be typeset as:
297 % \begin{ltxoutput*}
298 % \parshape = 5 0pt \linewidth 0pt \linewidth
299 % 2em \linewidth 2em \linewidth 0pt \linewidth
300 % \noindent There was an old party of Lyme \\
301 % Who married three wives at one time. \\
302 % When asked: `Why the third?' \\
303 % He replied: `One's absurd, \\
304 % And bigamy, sir, is a crime.' \par
305 % \end{ltxoutput*}
306 % All of this is about as much assistance as standard (La)TeX provides.
307 %
308 %
309 % \clearpage
310 % \section{The \Lpack{verse} package} \label{sec:usc}
311 %
312 % The code provided by the \Lpack{verse} package is meant to help
313 % with some aspects of typesetting poetry but does not, and cannot,
314 % provide a comprehensive solution to all the requirements that
315 % will arise.
316 %
317 % A brief introduction is included to get started quickly; see the examples in Section~\ref{sec:ex} for more context.
318 %
319 % \subsection{Brief introduction}
320 %
321 % The \Lpack{verse} package provides the |verse| environment for typesetting verses, overwriting \LaTeX's original definition.
322 % Every line in a verse environment must end with |\\|, and every stanza within a verse should end with |\\!| (an empty line afterwards is optional for readability).
323 % These requirements allow line numbering to work correctly in all cases.
324 % Use the \cs{poemlines}\marg{N} command to number every \meta{N}th line of a poem.
325 %
326 % Use the \cs{poemtitle}\marg{title} command (just before the |verse| environment) to give each poem a title; commands are provided to adjust the formatting and include the poem into the standard table of contents.
327 %
328 % Each stanza within a verse may optionally be surrounded by either an |altverse| or |patverse| environment to effect specific typesetting; |altverse| indents every second line of a stanza, and |patverse| allows arbitrary indentation based on the \meta{pattern} given by \cs{indentpattern}\marg{pattern}.
329 % The command \cs{flagverse}, placed at the very beginning of a stanza places a `title'; e.g., for numbering and otherwise labelling stanzas.
330 %
331 %
332 % \subsection{Comprehensive documentation}
333 %
334 % \subsubsection{Main verse environments}
335 %
336 % \DescribeEnv{verse}
337 % The |verse| environment provided by the package is an extension
338 % of the usual LaTeX environment. The environment takes one optional
339 % parameter, which is a length; for example |\begin{verse}[4em]|.
340 % You may have noticed that the earlier verse examples are all
341 % near the left margin, whereas verses usually look better if they
342 % are typeset about the center of the page. The length parameter,
343 % if given, should be about the length of an average line, and then
344 % the entire contents will be typeset with the mid point of the length
345 % centered horizontally on the page.
346 %
347 % \DescribeMacro{\versewidth}
348 % The length |\versewidth| is provided as a convenience. It may be used,
349 % for example, to calculate the length of a line of text for use
350 % as the optional argument to the |verse| environment:
351 % \begin{lstlisting}
352 % \settowidth{\versewidth}{This is the average line,}
353 % \begin{verse}[\versewidth]
354 % \end{lstlisting}
355 %
356 % \DescribeEnv{altverse}
357 % Within the |verse| environment verses are separated by a blank line
358 % in the input. Individual verses within |verse| may, however,
359 % be enclosed in the |altverse| environment. This has the effect of
360 % indenting the 2nd, 4th, etc., lines of the verse by the length |\vgap|.
361 %
362 % \DescribeEnv{patverse}
363 % Individual verses within the |verse| environment may be enclosed
364 % in the |patverse| environment. Within the environment the indentation
365 % of each line is specified by an indentation pattern, which consists
366 % of an array of digits, $d_{1}$ to $d_{n}$, and the $n^{th}$ line is
367 % indented by $d_{n}$ times |\vgap|. However, the first line is
368 % not indented, irrespective of the value of $d_{1}$.
369 %
370 % \DescribeEnv{patverse*}
371 % The |patverse*| environment is similar to |patverse| environment,
372 % except that the pattern will keep on repeating itself.
373 %
374 % \DescribeMacro{\indentpattern}
375 % The indentation pattern for a |patverse| environment is specified
376 % via the |\indentpattern{|\meta{digits}|}| command. If the pattern is
377 % shorter than the number of lines in a verse, the trailing lines will
378 % not be indented.
379 %
380 % \subsubsection{Other verse commands}
381 %
382 % \DescribeMacro{\\}
383 % Within the |verse| environment, the macro |\\| must be used at the
384 % end of each line of a verse, except for the last line in each stanza.
385 % If the lines in a poem are to be numbered then
386 % \DescribeMacro{\\!}
387 % |\\!| must be used at the
388 % end of the last line in each stanza (the |\\| macro increments the line
389 % numbers).
390 %
391 % \DescribeMacro{\\*}
392 % The starred version, |\\*|, prohibits a page break after the
393 % line.
394 % \DescribeMacro{\\>}
395 % The |\\>| version causes a linebreak within a verse line.
396 %
397 % The |\\| macro in its various forms can also take an optional length
398 % argument, like |\\[30pt]|
399 % which will insert |30pt| of vertical space; in the case of |\\>[30pt]|
400 % an additional 30pt of horizontal space will be inserted after the
401 % linebreak (effectively |\\>| is shorthand for |\verselinebreak|).
402 %
403 % The allowable forms of the
404 % macro are:
405 % \begin{center}
406 % |\\|, |\\*|. |\\!|, |\\>|, |\\[...]|, |\\*[...]|, |\\![...]|,
407 % and |\\>[...]|.
408 % \end{center}
409 %
410 % \DescribeMacro{\vin}
411 % \DescribeMacro{\vgap}
412 % The command |\vin| is shorthand for |\hspace{\vgap}| for use
413 % at the start of an indented line of verse. The length |\vgap|
414 % (initially 1.5em) can be changed by |\setlength| or |\addtolength|.
415 %
416 % \DescribeMacro{\vindent}
417 % When a verse line is too long to fit within the typeblock it is
418 % wrapped onto the next line with a space, given by the value of the
419 % length \cs{vindent}.
420 %
421 % \DescribeMacro{\verselinebreak}
422 % Using the command |\verselinebreak[|\meta{length}|]| will cause
423 % later text in the
424 % line of the verse to be typeset indented on the following line.
425 % If the optional length argument is not given the indentation is
426 % |\vgap|, otherwise the indentation is given by \meta{length} plus |\vgap|.
427 % The broken
428 % line will count as a single line as far as the |altverse| and |patverse|
429 % environments are concerned (see also the |\\>| macro).
430 %
431 % \DescribeMacro{\flagverse}
432 % \DescribeMacro{\vleftskip}
433 % Putting the command |\flagverse{|\meta{flag}|}| at the start of a line
434 % of verse will typeset \meta{flag} towards the left margin, ending
435 % a distance |\vleftskip| before the verse line.
436 %
437 % \subsubsection{Generic verse formatting}
438 %
439 % \DescribeMacro{\stanzaskip}
440 % The length |\stanzaskip| controls the spacing between stanzas.
441 % It may be changed like any other length.
442 %
443 % \DescribeMacro{\leftmargini}
444 % All verse lines have a minimum indent given by the length \cs{leftmargini}
445 % which also applies to any list environment. To change the minimum
446 % indent for verses do something along the lines:
447 % \begin{lstlisting}
448 % \newlength{\saveleftmargini}
449 % \setlength{\saveleftmargini}{\leftmargini}
450 % \setlength{\leftmargini}{-1em}% for example to outdent verse
451 % % verses
452 % \setlength{\leftmargini}{\saveleftmargini}% restore original value
453 % \end{lstlisting}
454 %
455 %
456 % \subsubsection{Line numbering}
457 %
458 % \DescribeMacro{\poemlines}
459 % The declaration |\poemlines{|\meta{nth}|}| will cause every \meta{nth}
460 % lines of succeeding verses to be numbered. For example, |\poemlines{5}|
461 % will number every fifth line. The default is |\poemlines{0}| which prevents
462 % any numbering.
463 %
464 % \DescribeMacro{\setverselinenums}
465 % The command \cs{setverselinenums}\marg{firstlinenum}\marg{startnumsat}
466 % can be used to set the number of the first verse line to \meta{firstlinenum}
467 % instead of the default `1' and to specify that the first printed line number
468 % should be for line number \meta{startnumsat}. If used the command must be
469 % given within the \texttt{verse} environment before the first line of the
470 % verses. For example, if you were quoting portions of poems from a source
471 % where the lines were numbered, your first line might be the 112th of the
472 % original and that line was originally numbered: \\
473 % \verb?\setverselinenums{112}{112}? \\
474 % or if it was line 115 that was first numbered: \\
475 % \verb?\setverselinenums{112}{115}?
476 %
477 % Note that the numbers must be such that the following relationship holds: \\
478 % \verb?firstlinenum <= startnumsat < firstlinenum + poemlines?
479 %
480 %
481 % \DescribeMacro{\thepoemline}
482 % \DescribeMacro{\verselinenumfont}
483 % Lines are numbered via \cs{thepoemline} which defaults to typesetting
484 % arabic numerals via: \\
485 % \verb?\renewcommand*{\thepoemline}{\arabic{poemline}}? \\
486 % The particular font is defined by \cs{verselinenumfont}\marg{font-spec},
487 % with default: \\
488 % \verb?\verselinenumfont{\rmfamily}? \\
489 %
490 % \DescribeMacro{\vrightskip}
491 % \DescribeMacro{\verselinenumbersleft}
492 % \DescribeMacro{\verselinenumbersright}
493 % By default the numbers are typeset at the distance \cs{vrightskip} into the
494 % right margin.
495 % If you want line numbers set at the left use the \cs{verselinenumbersleft}
496 % declaration. To revert to the default use \cs{verselinenumbersright}.
497 %
498 %
499 % \DescribeMacro{\label}
500 % \DescribeMacro{\ref}
501 % The standard |\label{|meta{key}|}| command
502 % can be used inside the |verse| environment, between the end of the text
503 % of a line and the line-ending |\\|, to grab that line number, no matter
504 % what the setting of |\poemlines|. Elsewhere the standard
505 % |\ref{|\meta{key}|}| command can be used to refer to the line number.
506 %
507 % \subsubsection{Titles}
508 %
509 % \DescribeMacro{\poemtitle}
510 % |\poemtitle[|\meta{short}|}{|\meta{long}|}| typesets the title
511 % of a poem and makes an entry into the ToC. There is a starred version
512 % that makes no ToC entry.
513 %
514 % \DescribeMacro{\poemtoc}
515 % The kind of entry made in the ToC by the |\poemtitle| command is
516 % defined by |\poemtoc|. The initial definition is: \\
517 % |\newcommand{\poemtoc}{section}| \\
518 % for a section-like ToC entry. This can be changed to, say, |chapter|
519 % or |subsection| or \ldots.
520 %
521 % \DescribeMacro{\poemtitlefont}
522 % This macro specifies the font and positioning of the poem title. Its
523 % initial definition is: \\
524 % |\newcommand{\poemtitlefont}{\normalfont\bfseries\large\centering}| \\
525 % to give a |\large| bold centered title. This can of course be renewed
526 % if you want something else.
527 %
528 % \DescribeMacro{\beforepoemtitleskip}
529 % \DescribeMacro{\afterpoemtitleskip}
530 % These two lengths are the vertical space before and after the |\poemtitle|
531 % title text. They are initially defined to give the same spacing
532 % as for a |\section| title. They can be changed by |\setlength| or
533 % |\addtolength| for different spacings.
534 %
535 %
536 % \DescribeMacro{\poemtitlemark}
537 % The |\poemtitle| macro, but not |\poemtitle*|,
538 % calls the |\poemtitlemark{|\meta{title}|}| macro,
539 % which is defined to do nothing. This would probably be changed by a
540 % pagestyle definition (like |\sectionmark| or |\chaptermark|).
541 %
542 % \subsection{Supports}
543 %
544 % The package includes some macros for supporting the |patverse|
545 % environment which may be more generally useful. See the code section
546 % for examples on how these may be used.
547 %
548 % \DescribeMacro{\newarray}
549 % |\newarray{|\meta{arrayname}|}{|\meta{low}|}{|\meta{high}|}| defines
550 % the \meta{arrayname} array, where \meta{arrayname} is a name like
551 % |MyArray|. The lowest and highest array indices are set to
552 % \meta{low} and \meta{high} respectively, where both are integer numbers.
553 %
554 % \DescribeMacro{\setarrayelement}
555 % |\setarrayelement{|\meta{arrayname}|}{|\meta{index}|}{|\meta{text}|}|
556 % sets the \meta{index} location in the \meta{arrayname} array to be
557 % \meta{text}. For example: \\
558 % |\setarrayelement{MyArray}{23}{$2^{23}$}|.
559 %
560 % \DescribeMacro{\getarrayelement}
561 % |\getarrayelement{|\meta{arrayname}|}{|\meta{index}|}{|\meta{result}|}|
562 % sets the parameterless macro \meta{result} to the contents of
563 % the \meta{index} location in the \meta{arrayname} array. For
564 % example: \\
565 % |\getarrayelement{MyArray}{23}{\result}|.
566 %
567 % \DescribeMacro{\checkarrayindex}
568 % |\checkarrayindex{|\meta{arrayname}|}{|\meta{index}|}| checks if
569 % \meta{arrayname} is an array and if \meta{index} is a valid index for
570 % the array.
571 %
572 % \DescribeMacro{\stringtoarray}
573 % |\stringtoarray{|\meta{arrayname}|}{|\meta{string}|}| puts each character
574 % from \meta{string} sequentially into the \meta{arrayname} array, starting
575 % at index 1. For example: \\
576 % |\stringtoarray{MyArray}{Chars}|.
577 %
578 % \DescribeMacro{\arraytostring}
579 % The macro |\arraytostring{|\meta{arrayname}|}{|\meta{result}|}| assumes
580 % that \meta{arrayname} is an array of characters, and defines the macro
581 % \meta{result} to be that sequence of characters. For example: \\
582 % |\arraytostring{MyArray}{\MyString}|.
583 %
584 % \DescribeMacro{\checkifinteger}
585 % |\checkifinteger{|\meta{num}|}| checks if \meta{num} is an integer (not less
586 % than zero). If it is then |\ifinteger| is set TRUE, otherwise it is set
587 % FALSE.
588 %
589 % \subsection{Examples}
590 % \label{sec:ex}
591 %
592 % Here are some sample verses using the package facilities.
593 % First our old Limerick friend, but titled and centered:
594 % \begin{lstlisting}
595 % \renewcommand{\poemtoc}{subsection}
596 % \poemtitle{A Limerick}
597 % \settowidth{\versewidth}{There was an old party of Lyme}
598 % \begin{verse}[\versewidth]
599 % There was an old party of Lyme \\
600 % Who married three wives at one time. \\
601 % \vin When asked: `Why the third?' \\
602 % \vin He replied: `One's absurd, \\
603 % And bigamy, sir, is a crime.' \\
604 % \end{verse}
605 % \end{lstlisting}
606 % which gets typeset as below. The default |\poemtoc| is redefined
607 % to |subsection| so the
608 % title is entered into the ToC as an unnumbered |\subsection|.
609 % \begin{ltxoutput}
610 % \renewcommand{\poemtoc}{subsection}
611 % \poemtitle{A Limerick}
612 % \settowidth{\versewidth}{There was an old party of Lyme}
613 % \begin{verse}[\versewidth]
614 % There was an old party of Lyme \\
615 % Who married three wives at one time. \\
616 % \vin When asked: `Why the third?' \\
617 % \vin He replied: `One's absurd, \\
618 % And bigamy, sir, is a crime.' \\
619 % \end{verse}
620 % \end{ltxoutput}
621 %
622 % \ablankline
623 %
624 % Next is the Garden verse within the |altverse| environment. It
625 % is titled and centered.
626 % \begin{lstlisting}
627 % \settowidth{\versewidth}{But now my love is dead}
628 % \poemtitle{Love's lost}
629 % \begin{verse}[\versewidth]
630 % \begin{altverse}
631 % \garden
632 % \end{altverse}
633 % \end{verse}
634 % \end{lstlisting}
635 % which produces:
636 % \begin{ltxoutput}
637 % \settowidth{\versewidth}{But now my love is dead}
638 % \poemtitle{Love's lost}
639 % \begin{verse}[\versewidth]
640 % \begin{altverse}
641 % \garden
642 % \end{altverse}
643 % \end{verse}
644 % \end{ltxoutput}
645 %
646 % \ablankline
647 %
648 % It is left up to you how you might want to add information about
649 % the author of a poem. Here is one example of a macro for this:
650 % \begin{lstlisting}
651 % \newcommand{\attrib}[1]{%
652 % \nopagebreak{\raggedleft\footnotesize #1\par}}
653 % \end{lstlisting}
654 % \newcommand{\attrib}[1]{%
655 % \nopagebreak{\raggedleft\footnotesize #1\par}}
656 %
657 % This can be used as in the next bit of doggerel.
658 % \begin{lstlisting}
659 % \poemtitle{Fleas}
660 % \settowidth{\versewidth}{What a funny thing is a flea}
661 % \begin{verse}[\versewidth]
662 % What a funny thing is a flea. \\
663 % You can't tell a he from a she. \\
664 % But he can. And she can. \\
665 % Whoopee! \\
666 % \end{verse}
667 % \attrib{Anonymous}
668 % \end{lstlisting}
669 %
670 % \begin{ltxoutput}
671 % \poemtitle{Fleas}
672 % \settowidth{\versewidth}{What a funny thing is a flea}
673 % \begin{verse}[\versewidth]
674 % What a funny thing is a flea. \\
675 % You can't tell a he from a she. \\
676 % But he can. And she can. \\
677 % Whoopee! \\
678 % \end{verse}
679 % \attrib{Anonymous}
680 % \end{ltxoutput}
681 %
682 % \ablankline
683 %
684 % Here is an example of line wrapping.
685 % \begin{lstlisting}
686 % \poemtitle{In the beginning}
687 % \settowidth{\versewidth}{And objects at rest tended to remain at rest}
688 % \begin{verse}[\versewidth]
689 % Then God created Newton, \\
690 % And objects at rest tended to remain at rest, \\
691 % And objects in motion tended to remain in motion, \\
692 % And energy was conserved
693 % and momentum was conserved
694 % and matter was conserved \\
695 % And God saw that it was conservative. \\
696 % \end{verse}
697 % \attrib{Possibly from \textit{Analog}, circa 1950}
698 % \end{lstlisting}
699 %
700 % \begin{ltxoutput}
701 % \poemtitle{In the beginning}
702 % \settowidth{\versewidth}{And objects at rest tended to remain at rest}
703 % \begin{verse}[\versewidth]
704 % Then God created Newton, \\
705 % And objects at rest tended to remain at rest, \\
706 % And objects in motion tended to remain in motion, \\
707 % And energy was conserved
708 % and momentum was conserved
709 % and matter was conserved \\
710 % And God saw that it was conservative. \\
711 % \end{verse}
712 % \attrib{Possibly from \textit{Analog}, circa 1950}
713 % \end{ltxoutput}
714 %
715 % \ablankline
716 %
717 % Here is one with a forced line break and a slightly different title style.
718 % \begin{lstlisting}
719 % \renewcommand{\poemtitlefont}{\normalfont\large\itshape\centering}
720 % \poemtitle{Mathematics}
721 % \settowidth{\versewidth}{Than Tycho Brahe, or Erra Pater:}
722 % \begin{verse}[\versewidth]
723 % In mathematics he was greater \\
724 % Than Tycho Brahe, or Erra Pater: \\
725 % For he, by geometric scale, \\
726 % Could take the size of pots of ale;\\ \settowidth{\versewidth}{Resolve by}
727 % Resolve, by sines \\>[\versewidth] and tangents straight, \\
728 % If bread or butter wanted weight; \\
729 % And wisely tell what hour o' the day \\
730 % The clock does strike, by Algebra. \\
731 % \end{verse}
732 % \attrib{Samuel Butler (1612--1680)}
733 % \end{lstlisting}
734 %
735 % \begin{ltxoutput}
736 % \renewcommand{\poemtitlefont}{\normalfont\large\itshape\centering}
737 % \poemtitle{Mathematics}
738 % \settowidth{\versewidth}{Than Tycho Brahe, or Erra Pater:}
739 % \begin{verse}[\versewidth]
740 % In mathematics he was greater \\
741 % Than Tycho Brahe, or Erra Pater: \\
742 % For he, by geometric scale, \\
743 % Could take the size of pots of ale;\\ \settowidth{\versewidth}{Resolve by}
744 % Resolve, by sines \\>[\versewidth] and tangents straight, \\
745 % If bread or butter wanted weight; \\
746 % And wisely tell what hour o' the day \\
747 % The clock does strike, by Algebra. \\
748 % \end{verse}
749 % \attrib{Samuel Butler (1612--1680)}
750 % \end{ltxoutput}
751 %
752 % \ablankline
753 %
754 % Another limerick, but this time taking advantage of the |patverse|
755 % environment and numbering every third line.
756 % \begin{lstlisting}
757 % \settowidth{\versewidth}{There was a young lady of Ryde}
758 % \poemtitle{The Young Lady of Ryde}
759 % \begin{verse}[\versewidth]
760 % \poemlines{3}
761 % \indentpattern{00110}
762 % \begin{patverse}
763 % There was a young lady of Ryde \\
764 % Who ate some apples and died. \\
765 % The apples fermented \\
766 % Inside the lamented \\
767 % And made cider inside her inside. \\
768 % \end{patverse}
769 % \poemlines{0}
770 % \end{verse}
771 % \end{lstlisting}
772 %
773 % \begin{ltxoutput}
774 % \settowidth{\versewidth}{There was a young lady of Ryde}
775 % \poemtitle{The Young Lady of Ryde}
776 % \begin{verse}[\versewidth]
777 % \poemlines{3}
778 % \indentpattern{00110}
779 % \begin{patverse}
780 % There was a young lady of Ryde \\
781 % Who ate some apples and died. \\
782 % The apples fermented \\
783 % Inside the lamented \\
784 % And made cider inside her inside. \\
785 % \end{patverse}
786 % \poemlines{0}
787 % \end{verse}
788 % \end{ltxoutput}
789 %
790 % \ablankline
791 %
792 % The next example is a song you may have heard of. The `forty-niner' in
793 % line \ref{vs:49} refers to the gold rush of 1849.
794 %
795 % \begin{lstlisting}
796 % \settowidth{\versewidth}{In a cavern, in a canyon,}
797 % \poemtitle{Clementine}
798 % \begin{verse}[\versewidth]
799 % \poemlines{2}
800 % \begin{altverse}
801 % \flagverse{1.} In a cavern, in a canyon, \\
802 % Excavating for a mine, \\
803 % Lived a miner, forty-niner, \label{vs:49} \\
804 % And his daughter, Clementine. \\!
805 % \end{altverse}
806 %
807 % \begin{altverse}
808 % \flagverse{\textsc{chorus}} Oh my darling, Oh my darling, \\
809 % Oh my darling Clementine. \\
810 % Thou art lost and gone forever, \\
811 % Oh my darling Clementine \\!
812 % \end{altverse}
813 % \poemlines{0}
814 % \end{verse}
815 % \end{lstlisting}
816 %
817 %
818 % \begin{ltxoutput}
819 % \settowidth{\versewidth}{In a cavern, in a canyon,}
820 % \poemtitle{Clementine}
821 % \begin{verse}[\versewidth]
822 % \poemlines{2}
823 % \begin{altverse}
824 % \flagverse{1.} In a cavern, in a canyon, \\
825 % Excavating for a mine, \\
826 % Lived a miner, forty-niner, \label{vs:49} \\
827 % And his daughter, Clementine. \\!
828 % \end{altverse}
829 %
830 % \begin{altverse}
831 % \flagverse{\textsc{chorus}} Oh my darling, Oh my darling, \\
832 % Oh my darling Clementine. \\
833 % Thou art lost and gone forever, \\
834 % Oh my darling Clementine \\!
835 % \end{altverse}
836 % \poemlines{0}
837 % \end{verse}
838 % \end{ltxoutput}
839 %
840 %
841 % The last example is a much more ambitious use of |\indentpattern|. In
842 % this case it is defined as: \\
843 % |\indentpattern{0135554322112346898779775545653222345544456688778899}| \\
844 % and the result is shown on the next page.
845 %
846 %
847 % \clearpage
848 % \begin{ltxoutput}
849 % \poemtitle{Mouse's Tale}
850 % \settowidth{\versewidth}{a mouse that morning}
851 % \indentpattern{0135554322112346898779775545653222345544456688778899}
852 % \begin{verse}[\versewidth]
853 % \setlength{\vgap}{1em}
854 % \begin{patverse}
855 % \large Fury said to \\
856 % a mouse, That \\
857 % he met \\
858 % in the \\
859 % house, \\
860 % \normalsize `Let us \\
861 % both go \\
862 % to law: \\
863 % \emph{I} will \\
864 % prosecute \\
865 % \textit{you.} --- \\
866 % Come, I'll \\
867 % \small take no \\
868 % denial; \\
869 % We must \\
870 % have a \\
871 % trial: \\
872 % For \\
873 % \footnotesize really \\
874 % this \\
875 % morning \\
876 % I've \\
877 % nothing \\
878 % to do.' \\
879 % Said the \\
880 % mouse to \\
881 % \scriptsize the cur, \\
882 % Such a \\
883 % trial, \\
884 % dear sir, \\
885 % With no \\
886 % jury or \\
887 % judge, \\
888 % would be \\
889 % wasting \\
890 % our breath.' \\
891 % \tiny `I'll be \\
892 % judge, \\
893 % I'll be \\
894 % jury.' \\
895 % Said \\
896 % cunning \\
897 % old Fury; \\
898 % `I'll try \\
899 % the whole \\
900 % cause \\
901 % and \\
902 % condemn \\
903 % you \\
904 % to \\
905 % death.' \par
906 % \end{patverse}
907 % \end{verse}
908 % \attrib{Lewis Carrol, \textit{Alice's Adventures in Wonderland}, 1865}
909 % \end{ltxoutput}
910 %
911 %
912 % \StopEventually{
913 % \bibliographystyle{alpha}
914 % \begin{thebibliography}{GMS94}
915 % \bibitem[GMS94]{GOOSSENS94}
916 % Michel Goossens, Frank Mittelbach, and Alexander Samarin.
917 % \newblock \emph{The LaTeX Companion}.
918 % \newblock Addison-Wesley Publishing Company, 1994.
919 % \bibitem[Wil01]{RUMOUR}
920 % Peter Wilson.
921 % \newblock \emph{A Rumour of Humour: A scientist's commonplace book}.
922 % \newblock To be published.
923 % \end{thebibliography}
924 % }
925 %
926 %
927 % \clearpage
928 % \section{The package code} \label{sec:code}
929 %
930 % To try and avoid name clashes, all the internal commands include
931 % the string |@vs|.
932 %
933 % \subsection{Preliminaries}
934 %
935 % Announce the name and version of the package, which requires
936 % \LaTeXe.
937 % \begin{macrocode}
938 %<*usc>
939 \NeedsTeXFormat{LaTeX2e}
940 \ProvidesPackage{verse}[2014/05/10 v2.4b verse typesetting]
941 % \end{macrocode}
942 %
943 % For reference, here is the original definition of the |verse| environment
944 % from \file{classes.dtx}, based on |\let|ting |\\| equal |\@centercr|.
945 % \begin{lstlisting}
946 % \newenvironment{verse}
947 % {\let\\\@centercr
948 % \list{}{\itemsep \z@
949 % \itemindent -1.5em%
950 % \listparindent\itemindent
951 % \rightmargin \leftmargin
952 % \advance\leftmargin 1.5em}%
953 % \item\relax}
954 % {\endlist}
955 % \end{lstlisting}
956 %
957 % \subsection{Verse code}
958 %
959 %
960 % \begin{macro}{vslineno}
961 % \begin{macro}{poemline}
962 % \begin{macro}{\c@fvsline}
963 % \begin{macro}{modulo@vs}
964 % \begin{macro}{verse@envctr}
965 % \begin{macro}{\theHpoemlines}
966 % We need a counter for verse lines and poem lines, and one for unique
967 % hyperref anchors (based on the verse environment). Also one for specifying
968 % the start of line numbering.
969 % \changes{v2.0}{2002/03/24}{Added poemline and modulo@vs counters}
970 % \changes{v2.22}{2005/08/22}{Added verse@envctr counter and
971 % \cs{theHpoemlines} for hyperref}
972 % \changes{v2.4}{2007/01/10}{Added fvsline counter}
973 % \changes{v2.4c}{2024/02/12}{Use provide/renew instead of newcommand}
974 % \begin{macrocode}
975 \newcounter{vslineno}
976 \newcounter{poemline}
977 \newcounter{fvsline}
978 \setcounter{fvsline}{0}
979 \newcounter{modulo@vs}
980 \newcounter{verse@envctr}\setcounter{verse@envctr}{0}
981 \providecommand{\theHpoemline}{}
982 \renewcommand*{\theHpoemline}{\arabic{verse@envctr}.\arabic{poemline}}
983 % \end{macrocode}
984 % \end{macro}
985 % \end{macro}
986 % \end{macro}
987 % \end{macro}
988 % \end{macro}
989 % \end{macro}
990 %
991 % \begin{macro}{\poemlines}
992 % |\poemlines{|\meta{nth}|}| specifies that every \meta{nth} poem line
993 % should be numbered. Default is not to number any lines.
994 % \changes{v2.0}{2002/03/24}{Added \cs{poemlines}}
995 % \begin{macrocode}
996 \newcommand{\poemlines}[1]{%
997 \ifnum#1>\z@
998 \setcounter{modulo@vs}{#1}%
999 \else
1000 \setcounter{modulo@vs}{0}%
1001 \fi
1002 }
1003 \poemlines{0}
1004 % \end{macrocode}
1005 % \end{macro}
1006 %
1007 % \begin{macro}{\verselinenumfont}
1008 % \begin{macro}{\vlvnumfont}
1009 % Set the font for line numbers.
1010 % \changes{v2.3}{2006/01/14}{Added \cs{verselinenumfont} and \cs{vlvnumfont}}
1011 % \begin{macrocode}
1012 \newcommand*{\verselinenumfont}[1]{\def\vlnumfont{#1}}
1013 \verselinenumfont{\rmfamily}
1014 % \end{macrocode}
1015 % \end{macro}
1016 % \end{macro}
1017 %
1018 % \begin{macro}{\setverselinenums}
1019 % \cs{setverslinenums}\marg{firstlinenum}\marg{startnumsat} sets the
1020 % number of the first verse line to be \meta{firstlinenum} and the
1021 % first line to be numbered to be \meta{startnumsat}. Note that
1022 % \verb?startnumsat < (firstlinenum + poemlines)?
1023 % \changes{v2.4}{2007/01/10}{Added \cs{setverselinenums}}
1024 % \begin{macrocode}
1025 \newcommand*{\setverselinenums}[2]{%
1026 % \end{macrocode}
1027 % Set the poemline counter to \verb?#1?.
1028 % \begin{macrocode}
1029 \setcounter{poemline}{#1}\addtocounter{poemline}{\m@ne}%
1030 \refstepcounter{poemline}%
1031 \ifnum\c@modulo@vs>\z@
1032 % \end{macrocode}
1033 % If line numbers are to be printed, set \cs{c@fvsline} to a suitable
1034 % value so that the first number to be printed will be line \verb?#2?.
1035 % \begin{macrocode}
1036 \@tempcnta #2\relax
1037 \divide\@tempcnta\c@modulo@vs
1038 \multiply\@tempcnta\c@modulo@vs
1039 \c@fvsline #2\relax
1040 \advance\c@fvsline-\@tempcnta
1041 \fi
1042 }
1043 % \end{macrocode}
1044 % \end{macro}
1045 %
1046 % \begin{macro}{\getmodulo@vs}
1047 % This returns either nothing or a poem line number for printing.
1048 % \changes{v2.0}{2002/03/24}{Added \cs{getmodulo@vs}}
1049 % \changes{v2.4}{2007/01/10}{Modified \cs{getmodulo@vs} for specified start
1050 % of line numbers}
1051 % \begin{macrocode}
1052 \newcommand{\getmodulo@vs}{\bgroup
1053 \ifnum\c@modulo@vs<\@ne % no line numbers
1054 \else
1055 \ifnum\c@modulo@vs<\tw@ % every line numbered
1056 \vlnumfont\thepoemline
1057 \else
1058 \@tempcnta\c@poemline
1059 \advance\@tempcnta -\c@fvsline
1060 \divide\@tempcnta\c@modulo@vs
1061 \multiply\@tempcnta\c@modulo@vs
1062 \advance\@tempcnta\c@fvsline
1063 \ifnum\@tempcnta=\c@poemline\vlnumfont\thepoemline\fi
1064 \fi
1065 \fi
1066 \egroup}
1067 % \end{macrocode}
1068 % \end{macro}
1069 %
1070 % \begin{macro}{\ifaltindent}
1071 % This should be set TRUE for indenting alternate lines.
1072 % \begin{macrocode}
1073 \newif\ifaltindent
1074 % \end{macrocode}
1075 % \end{macro}
1076 %
1077 % \begin{macro}{\ifpattern}
1078 % This should be set TRUE for indenting lines according to a pattern.
1079 % \begin{macrocode}
1080 \newif\ifpattern
1081 % \end{macrocode}
1082 % \end{macro}
1083 %
1084 % \begin{macro}{\ifstarpattern}
1085 % This should be set TRUE for indenting lines according in a |patverse*|
1086 % environment.
1087 % \changes{v2.1}{2002/03/8}{Added \cs{ifstarpattern}}
1088 % \begin{macrocode}
1089 \newif\ifstarpattern
1090 % \end{macrocode}
1091 % \end{macro}
1092 %
1093 % \begin{macro}{\versewidth}
1094 % |\versewidth| is a convenience length for the user.
1095 % \begin{macrocode}
1096 \newlength{\versewidth}
1097 % \end{macrocode}
1098 % \end{macro}
1099 %
1100 % \begin{macro}{\vgap}
1101 % \begin{macro}{\vin}
1102 % \begin{macro}{\vindent}
1103 % \begin{macro}{\stanzaskip}
1104 % The length |\vgap| is used as the basis for spacing. |\vin| makes
1105 % a horizontal space of |\vgap| and |\vindent| is the indentation
1106 % of wrapped lines in a verse. |\stanzaskip| controls the space
1107 % between stanzas.
1108 % \changes{v2.2}{2002/07/18}{Added \cs{stanzaskip}}
1109 % \begin{macrocode}
1110 \newlength{\vgap}
1111 \setlength{\vgap}{1.5em}
1112 \newcommand{\vin}{\hspace*{\vgap}}
1113 \newlength{\vindent}
1114 \setlength{\vindent}{2\vgap}
1115 \newlength{\stanzaskip}
1116 \setlength{\stanzaskip}{0.75\baselineskip}
1117 % \end{macrocode}
1118 % \end{macro}
1119 % \end{macro}
1120 % \end{macro}
1121 % \end{macro}
1122 %
1123 % \begin{macro}{\vleftskip}
1124 % \begin{macro}{\vrightskip}
1125 % Skips to the left and right of a line of verse.
1126 % \changes{v2.0}{2002/03/24}{Added \cs{vleftksip} and \cs{vrightskip}}
1127 % \begin{macrocode}
1128 \newlength{\vleftskip}
1129 \setlength{\vleftskip}{30pt}
1130 \newlength{\vrightskip}
1131 \setlength{\vrightskip}{10pt}
1132 % \end{macrocode}
1133 % \end{macro}
1134 % \end{macro}
1135 %
1136 % \begin{macro}{\flagverse}
1137 % |\flagverse{|\meta{flag}|}| inserts \meta{flag} at the left (of a line).
1138 % \changes{v2.0}{2002/03/24}{Added \cs{flagverse}}
1139 % \begin{macrocode}
1140 \newcommand{\flagverse}[1]{%
1141 \hskip-\vleftskip\llap{#1}\hskip\vleftskip
1142 \ignorespaces
1143 }
1144 % \end{macrocode}
1145 % \end{macro}
1146 %
1147 % \begin{macro}{\verselinebreak}
1148 % Break a verse line by inserting \cs{newline}.\footnote{In an email to me
1149 % dated 2006/01/13 Aaron Rendahl pointed out that this should include
1150 % an \cs{ignorespaces}.}
1151 % \changes{v2.0}{2002/03/24}{Modified \cs{verselinebreak}}
1152 % \changes{v2.1}{2002/03/28}{Modified \cs{verselinebreak}}
1153 % \changes{v2.3}{2006/01/14}{Added \cs{ignorespaces} to \cs{verselinebreak}}
1154 % \begin{macrocode}
1155 \newcommand*{\verselinebreak}[1][\z@]{%
1156 \newline\hspace*{#1}%
1157 \ignorespaces
1158 }
1159 % \end{macrocode}
1160 % \end{macro}
1161 %
1162 % \begin{macro}{\incr@vsline}
1163 % Increment the line counters.
1164 % \changes{v2.0}{2002/03/24}{Added poemline counter to \cs{incr@vsline}}
1165 % \begin{macrocode}
1166 \newcommand{\incr@vsline}{%
1167 \refstepcounter{poemline}%
1168 \stepcounter{vslineno}%
1169 }
1170 % \end{macrocode}
1171 % \end{macro}
1172 %
1173 % \begin{macro}{\@vsifbang}
1174 % Like the kernel |\@ifstar| except it looks for an exclamation mark!
1175 % \changes{v2.0}{2002/03/24}{Added \cs{@vsifbang}}
1176 % \begin{macrocode}
1177 \newcommand{\@vsifbang}[1]{\@ifnextchar !{\@firstoftwo{#1}}}
1178 % \end{macrocode}
1179 % \end{macro}
1180 %
1181 % \begin{macro}{\@vsifgt}
1182 % Like the kernel |\@ifstar| except it looks for a |>| character.
1183 % \changes{v2.1}{2002/03/28}{Added \cs{@vsifgt}}
1184 % \begin{macrocode}
1185 \newcommand{\@vsifgt}[1]{\@ifnextchar >{\@firstoftwo{#1}}}
1186 % \end{macrocode}
1187 % \end{macro}
1188 %
1189 % \begin{macro}{\@vstypelinenumright}
1190 % \begin{macro}{\@vstypelinenumleft}
1191 % \begin{macro}{\verselinenumbersright}
1192 % \begin{macro}{\verselinenumbersleft}
1193 % These control the typesetting of verse line numbers to the
1194 % right and to the left of the verse. Default is to set them at
1195 % the right.
1196 % \changes{v2.3}{2006/01/14}{Added left/right switching line numbers}
1197 % \begin{macrocode}
1198 \newcommand*{\@vstypelinenumright}{%
1199 \hfill\rlap{\kern\vrightskip\kern\rightmargin\getmodulo@vs}%
1200 }
1201 \newcommand*{\@vstypelinenumleft}{%
1202 \hfill\rlap{\kern-\textwidth\kern-\vrightskip\getmodulo@vs}%
1203 }
1204 \newcommand*{\verselinenumbersright}{\def\@vstypelinenum{\@vstypelinenumright}}
1205 \newcommand*{\verselinenumbersleft} {\def\@vstypelinenum{\@vstypelinenumleft}}
1206 \verselinenumbersright
1207 % \end{macrocode}
1208 % \end{macro}
1209 % \end{macro}
1210 % \end{macro}
1211 % \end{macro}
1212 %
1213 % \begin{macro}{\@vscentercr}
1214 % This puts the poem line number in the margin, increments
1215 % the line numbers, and then deals with the options. It is based
1216 % on the kernel |\@centercr|.
1217 % This has to handle various forms of the |\\| command: |\\|,
1218 % |\\*|, |\\!|, and |\\>|, together with an optional length argument.
1219 % \changes{v1.1}{2001/08/03}{Changed definition of \cs{@centercrplus}}
1220 % \changes{v2.0}{2002/03/24}{Renamed \cs{@centercrplus} as \cs{@vscentercr}}
1221 % \changes{v2.0}{2002/03/24}{Major rewrite of \cs{@vscentercr} and friends}
1222 % \changes{v2.1}{2002/03/28}{Added greater than character to \cs{@vscentercr}}%
1223 % \changes{v2.3}{2006/01/14}{Used \cs{@vstypelinenum} in \cs{@vscentercr}}
1224 % \begin{macrocode}
1225 \newcommand{\@vscentercr}{%
1226 \ifhmode \unskip\else \@nolnerr\fi
1227 \@vstypelinenum
1228 %%%% \hfill\rlap{\kern\vrightskip\kern\rightmargin\getmodulo@vs}%
1229 % \end{macrocode}
1230 % For |>| call |\verselinebreak| to process it.
1231 % \begin{macrocode}
1232 \@vsifgt{\verselinebreak}{%
1233 \incr@vsline
1234 % \end{macrocode}
1235 % If the call is |\\*...| call |\@vsxcentercr| to handle the |*...|.
1236 % If the call is |\\!|, do nothing.
1237 % If the call is |\\![...]|, call |\@vsicentercr| to handle the |[...]|.
1238 % Otherwise, call |\@vsxcentercr|.
1239 % \begin{macrocode}
1240 \par\@ifstar{\nobreak\@vsxcentercr}{%
1241 \@vsifbang{\@ifnextchar[ {\@vsicentercr}{}}{\@vsxcentercr}%
1242 }%
1243 }%
1244 }
1245 % \end{macrocode}
1246 % \end{macro}
1247 %
1248 % \begin{macro}{\@vsxcentercr}
1249 % Processes |\\*|, and either calls |\@vsicentercr| to handle a |[length]|,
1250 % or |\start@vsline|.
1251 % \changes{v2.0}{2002/03/24}{Added \cs{@vsxcentercr}}
1252 % \begin{macrocode}
1253 \newcommand{\@vsxcentercr}{%
1254 \addvspace{-\parskip}%
1255 \@ifnextchar[ {\@vsicentercr}{\start@vsline}%
1256 }
1257 % \end{macrocode}
1258 % \end{macro}
1259 %
1260 % \begin{macro}{\@vsicentercr}
1261 % Processes |(\\...)[length]| and then calls |\start@vsline|.
1262 % \changes{v2.0}{2002/03/24}{Added \cs{@vsicentercr}}
1263 % \begin{macrocode}
1264 \def\@vsicentercr[#1]{\vskip #1\ignorespaces \start@vsline}
1265 % \end{macrocode}
1266 % \end{macro}
1267 %
1268 % \begin{macro}{\start@vsline}
1269 % This is called at the start of every verse line except the first.
1270 % \changes{v1.1}{2001/08/03}{Added \cs{start@vsline}}
1271 % \changes{v2.1}{2002/03/28}{Added \cs{ifstarpattern} to \cs{start@vsline}}
1272 % \changes{v2.21}{2004/03/22}{Changed \cs{thevslineno} to \cs{c@vslineno} in
1273 % \cs{start@vsline}}
1274 % \begin{macrocode}
1275 \newcommand{\start@vsline}{%
1276 \ifaltindent\ifodd\c@vslineno\else\vin\fi\fi%
1277 \ifpattern\get@vsindent\fi%
1278 \ifstarpattern\getstar@vsindent\fi
1279 }
1280 % \end{macrocode}
1281 % \end{macro}
1282 %
1283 % \begin{environment}{verse}
1284 % The extended |verse| environment. It sets the verse line counter,
1285 % then defines the particular list environment adjusting the margins
1286 % to center according to the length parameter. If the length parameter
1287 % is at least the |\linewidth| then the `centering' defaults to
1288 % the original |verse| layout.
1289 % \changes{v1.1}{2001/08/03}{Initialise the line counter to 1, not 0, in
1290 % all cases}
1291 % \changes{v1.2}{2001/10/28}{Fixed new verse environment to match spacings
1292 % of the original (misplaced close brace)}
1293 % \changes{v2.2}{2002/07/18}{Added \cs{stanzaskip} to the verse environment}
1294 % \changes{v2.22}{2005/08/22}{Added verse@envctr to the verse environment}
1295 % \begin{macrocode}
1296 \renewenvironment{verse}[1][\linewidth]{%
1297 \stepcounter{verse@envctr}%
1298 \setcounter{poemline}{0}\refstepcounter{poemline}%
1299 \setcounter{vslineno}{1}%
1300 \let\\=\@vscentercr
1301 \list{}{\itemsep \z@
1302 \itemindent -\vindent%
1303 \listparindent\itemindent
1304 \parsep \stanzaskip
1305 \ifdim #1 < \linewidth
1306 \rightmargin \z@
1307 \setlength{\leftmargin}{\linewidth}%
1308 \addtolength{\leftmargin}{-#1}%
1309 \addtolength{\leftmargin}{-0.5\leftmargin}%
1310 \else
1311 \rightmargin \leftmargin
1312 \fi
1313 \addtolength{\leftmargin}{\vindent}}%
1314 \item[]%
1315 }
1316 {\endlist}
1317 % \end{macrocode}
1318 % \end{environment}
1319 %
1320 % \begin{environment}{altverse}
1321 % This sets |\altindenttrue| (afterwards false) and initialises the line counter.
1322 % \changes{v2.1}{2002/03/28}{Added \cs{starpatternfalse} to altverse}
1323 % \begin{macrocode}
1324 \newenvironment{altverse}%
1325 {\starpatternfalse\patternfalse\altindenttrue\setcounter{vslineno}{1}}%
1326 {\altindentfalse}
1327 % \end{macrocode}
1328 % \end{environment}
1329 %
1330 % \subsection{Pattern code}
1331 %
1332 % The pattern code is based on the idea of converting a string of
1333 % digits to an array of digits, and then being able to access the
1334 % digit at a particular position in the array.
1335 % \changes{v1.1}{2001/08/03}{Added all the pattern code}
1336 %
1337 % \begin{macro}{\vs@nameedef}
1338 % A shorthand for using |\protected@edef|.
1339 % \begin{macrocode}
1340 \newcommand{\vs@nameedef}[1]{%
1341 \expandafter\protected@edef\csname #1\endcsname
1342 }
1343 % \end{macrocode}
1344 % \end{macro}
1345 %
1346 %
1347 % \begin{macro}{\ifbounderror}
1348 % A flag set TRUE if an attempt is made to access an array element outside
1349 % the array limits.
1350 % \begin{macrocode}
1351 \newif\ifbounderror
1352 % \end{macrocode}
1353 % \end{macro}
1354 %
1355 % \begin{macro}{\ifinteger}
1356 % A flag to indicate if a `number' is an integer (TRUE) or not (FALSE).
1357 % \begin{macrocode}
1358 \newif\ifinteger
1359 % \end{macrocode}
1360 % \end{macro}
1361 %
1362 % \begin{macro}{\c@chrsinstr}
1363 % A counter for the number of characters.
1364 % \begin{macrocode}
1365 \newcounter{chrsinstr} % CHARactersINSTRing
1366 % \end{macrocode}
1367 % \end{macro}
1368 %
1369 %
1370 % \begin{macro}{\newarray}
1371 % |\newarray{|\meta{arrayname}|}{|\meta{low}|}{|\meta{high}|}| defines
1372 % an array called \meta{arrayname} (no backslash e.g. |MyArray|),
1373 % with low and high limits \meta{low} and \meta{high}.
1374 % \begin{macrocode}
1375 \newcommand{\newarray}[3]{%
1376 \vs@nameedef{#1-low}{#2}%
1377 \vs@nameedef{#1-high}{#3}%
1378 \ifnum #3<#2
1379 \PackageError{verse}{Limits for array #1 are in reverse order}{\@ehc}%
1380 \fi
1381 }
1382 % \end{macrocode}
1383 % \end{macro}
1384 %
1385 %
1386 % \begin{macro}{\stringtoarray}
1387 % |\stringtoarray{|\meta{arrayname}|}{|\meta{string}|}| puts each character
1388 % from \meta{string} sequentially into the \meta{arrayname} array, starting
1389 % with \meta{low} = 1. It checks for an empty \meta{string} and handles that
1390 % specially.
1391 % \begin{macrocode}
1392 \newcommand{\stringtoarray}[2]{%
1393 \def\@vsarrayname{#1}%
1394 \protected@edef\the@vsstring{#2}%
1395 \newarray{\@vsarrayname}{1}{1}%
1396 \@ifmtarg{#2}{%
1397 \c@chrsinstr \z@
1398 \@namedef{\@vsarrayname-1}{}%
1399 }{%
1400 \c@chrsinstr \@ne
1401 \expandafter\@vsstringtoarray \the@vsstring\@vsend
1402 }%
1403 }
1404 % \end{macrocode}
1405 % \end{macro}
1406 %
1407 %
1408 % \begin{macro}{\@vsstringtoarray}
1409 % Recursively adds characters to the array |\@vsarrayname|, incrementing
1410 % the array's high limit.
1411 % \begin{macrocode}
1412 \def\@vsstringtoarray #1#2\@vsend{%
1413 \@namedef{\@vsarrayname-\the\c@chrsinstr}{#1}%
1414 \vs@nameedef{\@vsarrayname-high}{\the\c@chrsinstr}%
1415 \@ifmtarg{#2}{%
1416 \def\@vsinext{}%
1417 }{%
1418 \advance\c@chrsinstr \@ne
1419 \def\@vsinext{%
1420 \@vsstringtoarray #2\@vsend%
1421 }%
1422 }%
1423 \@vsinext
1424 }
1425 % \end{macrocode}
1426 % \end{macro}
1427 %
1428 %
1429 % \begin{macro}{\setarrayelement}
1430 % |\setarrayelement{|\meta{arrayname}|}{|\meta{index}|}{|\meta{value}|}| sets
1431 % the \meta{arrayname} array's element at \meta{index} to \meta{value}.
1432 % \begin{macrocode}
1433 \newcommand{\setarrayelement}[3]{%
1434 \checkarrayindex{#1}{#2}%
1435 \vs@nameedef{#1-#2}{#3}%
1436 }
1437 % \end{macrocode}
1438 % \end{macro}
1439 %
1440 %
1441 % \begin{macro}{\getarrayelement}
1442 % |\getarrayelement{|\meta{arrayname}|}{|\meta{index}|}{|\meta{value}|}|
1443 % defines the parameterless macro \meta{value} (e.g., |\result|) to be
1444 % the value at \meta{index} in the \meta{arrayname} array.
1445 % \begin{macrocode}
1446 \newcommand{\getarrayelement}[3]{%
1447 \checkarrayindex{#1}{#2}%
1448 \protected@edef#3{\@nameuse{#1-#2}}%
1449 }
1450 % \end{macrocode}
1451 % \end{macro}
1452 %
1453 %
1454 % \begin{macro}{\checkarrayindex}
1455 % |\checkarrayindex{|\meta{arrayname}|}{|\meta{index}|}| checks that
1456 % the \meta{index} of the \meta{arrayname} array is valid. |\ifbounderror|
1457 % is set FALSE if everything is OK, otherwise it is set TRUE.
1458 % \begin{macrocode}
1459 \newcommand{\checkarrayindex}[2]{%
1460 \bounderrorfalse
1461 \expandafter\ifx\csname #1-low\endcsname\relax
1462 \ifpattern\else
1463 \PackageError{verse}{No array called #1}{\@ehc}%
1464 \fi
1465 \bounderrortrue
1466 \fi
1467 \ifnum #2<\@nameuse{#1-low}\relax
1468 \ifpattern\else
1469 \PackageError{verse}{Index #2 outside limits for array #1}{\@ehc}%
1470 \fi
1471 \bounderrortrue
1472 \fi
1473 \ifnum #2>\@nameuse{#1-high}\relax
1474 \ifpattern\else
1475 \PackageError{verse}{Index #2 outside limits for array #1}{\@ehc}%
1476 \fi
1477 \bounderrortrue
1478 \fi
1479 }
1480 % \end{macrocode}
1481 % \end{macro}
1482 %
1483 %
1484 % \begin{macro}{\@ifmtarg}
1485 % Provides an if-then-else command for an empty macro argument
1486 % (empty = zero or more spaces only). Use as: \\
1487 % |\@ifmtarg{arg1}{Code for arg1 empty}{Code for arg1 not empty}| \\
1488 % This code is copied from my \Lpack{ifmtarg} package.
1489 % \begin{macrocode}
1490 \begingroup
1491 \catcode`\Q=3
1492 \long\gdef\@ifmtarg#1{\@xifmtarg#1QQ\@secondoftwo\@firstoftwo\@nil}
1493 \long\gdef\@xifmtarg#1#2Q#3#4#5\@nil{#4}
1494 \long\gdef\@ifnotmtarg#1{\@xifmtarg#1QQ\@firstofone\@gobble\@nil}
1495 \endgroup
1496 % \end{macrocode}
1497 % \end{macro}
1498 %
1499 %
1500 % \begin{macro}{\arraytostring}
1501 % |\arraytostring{|\meta{arrayname}|}{|\meta{string}|}| converts the
1502 % characters in the \meta{arrayname} array into the parameterless macro
1503 % \meta{string} (e.g., |\MyString|).
1504 % \begin{macrocode}
1505 \newcommand{\arraytostring}[2]{%
1506 \def#2{}%
1507 \c@chrsinstr = \@nameuse{#1-low}%
1508 \@vsarraytostring{#1}{#2}%
1509 }
1510 % \end{macrocode}
1511 % \end{macro}
1512 %
1513 %
1514 % \begin{macro}{\@vsarraytostring}
1515 % |\@vsarraytostring{|\meta{arrayname}|}{|\meta{string}|}| recursively
1516 % adds the (character) elements from \meta{arrayname} to \meta{string}.
1517 % \begin{macrocode}
1518 \newcommand{\@vsarraytostring}[2]{%
1519 \ifnum\c@chrsinstr>\@nameuse{#1-high}\else
1520 \protected@edef#2{#2\@nameuse{#1-\thechrsinstr}}%
1521 \advance\c@chrsinstr\@ne%
1522 \@vsarraytostring{#1}{#2}%
1523 \fi%
1524 }
1525 % \end{macrocode}
1526 % \end{macro}
1527 %
1528 %
1529 % \begin{macro}{\checkifinteger}
1530 % |\checkifinteger{|\meta{num}|}| checks if \meta{num} is an integer.
1531 % If it is, then |\ifinteger| is set TRUE, otherwise it is set FALSE.
1532 % (Code based on Donald Arseneau's \Lpack{cite} package).
1533 % \begin{macrocode}
1534 \newcommand{\checkifinteger}[1]{%
1535 \protected@edef\@vsa{#1}%
1536 \ifcat _\ifnum9<1\gobm{#1} _\else A\fi
1537 \integertrue
1538 \else
1539 \integerfalse
1540 \fi
1541 }
1542 % \end{macrocode}
1543 % \end{macro}
1544 %
1545 %
1546 % \begin{macro}{\gobm}
1547 % |\gobm{|\meta{num}|}| is defined as \meta{num}. It could be defined as: \\
1548 % |\newcommand{\gobm}[1]{\ifx-#1\expandafter\gobm\else#1\fi}| \\
1549 % which would remove a leading minus sign (hyphen) from its argument
1550 % (|gobm| = gobble minus sign).
1551 % (Code from a posting to CTT by Donald Arseneau on 1997/07/21).
1552 % \begin{macrocode}
1553 \newcommand{\gobm}[1]{#1}
1554 % \end{macrocode}
1555 % \end{macro}
1556 %
1557 % \begin{macro}{\indentpattern}
1558 % |\indentpattern{|\meta{digits}|}| stores \meta{digits} for use as
1559 % a verse indentation pattern.
1560 % \begin{macrocode}
1561 \newcommand{\indentpattern}[1]{%
1562 \stringtoarray{Array@vs}{#1}%
1563 }
1564 % \end{macrocode}
1565 % \end{macro}
1566 %
1567 %
1568 % \begin{macro}{\get@vsindent}
1569 % |\get@vsindent| gets the indent pattern digit for the |\thevslineno|,
1570 % then uses this to specify the line indentation as |digit*\vgap|.
1571 % \changes{v2.21}{2004/03/21}{Changed \cs{thevslineno} to
1572 % \cs{number}\cs{value}\texttt{vslineno} in \cs{get@vsindent}}
1573 % \begin{macrocode}
1574 \newcommand{\get@vsindent}{%
1575 \getarrayelement{Array@vs}{\number\value{vslineno}}{\@vspat}%
1576 \ifbounderror
1577 \arraytostring{Array@vs}{\@vsp@t}%
1578 \PackageWarning{verse}{%
1579 Index `\thevslineno' for pattern `\@vsp@t' is out of bounds}%
1580 \def\@vspat{0}%
1581 \else
1582 \checkifinteger{\@vspat}%
1583 \ifinteger\else
1584 \arraytostring{Array@vs}{\@vsp@t}%
1585 \PackageWarning{verse}{%
1586 `\@vspat' at index `\thevslineno' in pattern `\@vsp@t' is not a digit}%
1587 \def\@vspat{0}%
1588 \fi
1589 \fi
1590 \ifcase\@vspat\else\hspace*{\@vspat\vgap}\fi
1591 }
1592 % \end{macrocode}
1593 % \end{macro}
1594 %
1595 % \begin{macro}{\getstar@vsindent}
1596 % |\getstar@vsindent| gets the indent pattern digit for the |patverse*|
1597 % environment,
1598 % then uses this to specify the line indentation as |digit*\vgap|.
1599 % It lets the pattern repeat by resetting the |vslineno| counter.
1600 % \changes{v2.1}{2002/03/28}{Added \cs{getstar@vsindent}}
1601 % \begin{macrocode}
1602 \newcommand{\getstar@vsindent}{%
1603 \expandafter\ifx\csname Array@vs-high\endcsname\relax
1604 \PackageError{verse}{A pattern has not been specified}{\@ehc}%
1605 \else
1606 \ifnum\c@vslineno>\@nameuse{Array@vs-high}%
1607 \setcounter{vslineno}{1}%
1608 \fi
1609 \get@vsindent
1610 \fi
1611 }
1612 % \end{macrocode}
1613 % \end{macro}
1614 %
1615 %
1616 % \begin{environment}{patverse}
1617 % The environment for setting verse line indents according to a pattern.
1618 % It starts by setting |\ifpattern| TRUE, any other flags to FALSE,
1619 % and initialises the line number. It ends by setting |\ifpattern| FALSE.
1620 % \changes{v2.1}{2002/03/28}{Added \cs{starpatternfalse} to patverse}
1621 % \begin{macrocode}
1622 \newenvironment{patverse}
1623 {\starpatternfalse\patterntrue\altindentfalse\setcounter{vslineno}{1}}
1624 {\patternfalse}
1625 % \end{macrocode}
1626 % \end{environment}
1627 %
1628 % \begin{environment}{patverse*}
1629 % The environment for setting verse line indents according to a repeating
1630 % pattern.
1631 % It starts by setting |\ifstarpattern| TRUE, any other flags to FALSE,
1632 % and initialises the line number. It ends by setting |\ifstarpattern| FALSE.
1633 % \changes{v2.1}{2002/03/28}{Added patverse* environment}
1634 % \begin{macrocode}
1635 \newenvironment{patverse*}
1636 {\starpatterntrue\patternfalse\altindentfalse\setcounter{vslineno}{1}}
1637 {\starpatternfalse}
1638 % \end{macrocode}
1639 % \end{environment}
1640 %
1641 % \subsection{Title code}
1642 %
1643 % \begin{macro}{\poemtitle}
1644 % Typeset a poem title (like |\section| or other). The actual work
1645 % is done by |\@vsptitle| (plain) or |\@vssptitle| (starred).
1646 % \begin{macrocode}
1647 \newcommand{\poemtitle}{%
1648 \par
1649 \secdef\@vsptitle\@vssptitle
1650 }
1651 % \end{macrocode}
1652 % \end{macro}
1653 %
1654 % \begin{macro}{\poemtoc}
1655 % The kind of entry |\poemtitle| is to make in the ToC.
1656 % \begin{macrocode}
1657 \newcommand{\poemtoc}{section}
1658 % \end{macrocode}
1659 % \end{macro}
1660 %
1661 % \begin{macro}{\@vsptitle}
1662 % Typeset a |poemtitle|.
1663 % \changes{v2.22}{2005/08/22}{Added hyperref anchor to \cs{@vsptitle}}
1664 % \begin{macrocode}
1665 \def\@vsptitle[#1]#2{%
1666 \@nameuse{phantomsection}%
1667 \addcontentsline{toc}{\poemtoc}{#1}%
1668 \poemtitlemark{#1}%
1669 \@vstypeptitle{#2}%
1670 \@afterheading
1671 }
1672 % \end{macrocode}
1673 % \end{macro}
1674 %
1675 % \begin{macro}{\@vssptitle}
1676 % Typeset a |\poemtitle*|.
1677 % \begin{macrocode}
1678 \def\@vssptitle#1{%
1679 \@vstypeptitle{#1}
1680 \@afterheading
1681 }
1682 % \end{macrocode}
1683 % \end{macro}
1684 %
1685 % \begin{macro}{\@vstypeptitle}
1686 % This \emph{really} typesets the title.
1687 % \begin{macrocode}
1688 \newcommand{\@vstypeptitle}[1]{%
1689 \vspace{\beforepoemtitleskip}%
1690 {\poemtitlefont #1\par}%
1691 \vspace{\afterpoemtitleskip}%
1692 }
1693 % \end{macrocode}
1694 % \end{macro}
1695 %
1696 % \begin{macro}{\poemtitlefont}
1697 % \begin{macro}{\poemtitlemark}
1698 % Sets the appearance to the title of a poem, and something for a header.
1699 % \begin{macrocode}
1700 \newcommand{\poemtitlefont}{\normalfont\large\bfseries\centering}
1701 \newcommand{\poemtitlemark}[1]{}
1702 % \end{macrocode}
1703 % \end{macro}
1704 % \end{macro}
1705 %
1706 % \begin{macro}{\beforepoemtitleskip}
1707 % \begin{macro}{\afterpoemtitleskip}
1708 % Lengths before and after a poem title, using the |\section| values.
1709 % \begin{macrocode}
1710 \newlength{\beforepoemtitleskip}
1711 \setlength{\beforepoemtitleskip}{3.5ex \@plus 1ex \@minus .2ex}
1712 \newlength{\afterpoemtitleskip}
1713 \setlength{\afterpoemtitleskip}{2.3ex \@plus.2ex}
1714 % \end{macrocode}
1715 % \end{macro}
1716 % \end{macro}
1717 %
1718 % The end of this package.
1719 % \begin{macrocode}
1720 %</usc>
1721 % \end{macrocode}
1722 %
1723 % \Finale
1724 % \PrintIndex
1725 %
1726 \endinput
1727 %% \CharacterTable
1728 %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
1729 %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
1730 %% Digits \0\1\2\3\4\5\6\7\8\9
1731 %% Exclamation \! Double quote \" Hash (number) \#
1732 %% Dollar \$ Percent \% Ampersand \&
1733 %% Acute accent \' Left paren \( Right paren \)
1734 %% Asterisk \* Plus \+ Comma \,
1735 %% Minus \- Point \. Solidus \/
1736 %% Colon \: Semicolon \; Less than \<
1737 %% Equals \= Greater than \> Question mark \?
1738 %% Commercial at \@ Left bracket \[ Backslash \\
1739 %% Right bracket \] Circumflex \^ Underscore \_
1740 %% Grave accent \` Left brace \{ Vertical bar \|
1741 %% Right brace \} Tilde \~}
1742
1743