summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/verse/verse.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/verse/verse.dtx')
-rw-r--r--Master/texmf-dist/source/latex/verse/verse.dtx117
1 files changed, 90 insertions, 27 deletions
diff --git a/Master/texmf-dist/source/latex/verse/verse.dtx b/Master/texmf-dist/source/latex/verse/verse.dtx
index 99873ab3569..a4395e105fa 100644
--- a/Master/texmf-dist/source/latex/verse/verse.dtx
+++ b/Master/texmf-dist/source/latex/verse/verse.dtx
@@ -1,11 +1,9 @@
% \iffalse meta-comment
%
-%
% verse.dtx
% Author: Peter Wilson (herries dot press at earthlink dot net)
% Herries Press
-% (or at: pandgwilson at earthlink dot net)
-% Copyright 2001--2005 Peter R. Wilson
+% Copyright 2001--2006 Peter R. Wilson
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
@@ -20,8 +18,6 @@
%
% This work consists of the files listed in the README file.
%
-%
-%
%<*driver>
\documentclass{ltxdoc}
\usepackage{alltt}
@@ -37,7 +33,7 @@
%
% \fi
%
-% \CheckSum{483}
+% \CheckSum{524}
%
% \DoNotIndex{\',\.,\@M,\@@input,\@addtoreset,\@arabic,\@badmath}
% \DoNotIndex{\@centercr,\@cite}
@@ -88,6 +84,7 @@
% \changes{v2.2}{2002/07/18}{Added interstanza spacing}
% \changes{v2.21}{2004/03/21}{Made compatible with hangul package}
% \changes{v2.22}{2005/08/22}{Made compatible with hyperref package}
+% \changes{v2.3}{2006/01/14}{Added switch for linenumber side}
%
% \def\dtxfile{verse.dtx}
% ^^A \def\fileversion{v1.0}
@@ -102,6 +99,7 @@
% \def\fileversion{v2.2} \def\filedate{2002/07/18}
% \def\fileversion{v2.21} \def\filedate{2004/03/21}
% \def\fileversion{v2.22} \def\filedate{2005/08/22}
+% \def\fileversion{v2.3} \def\filedate{2006/01/14}
% \newcommand*{\Lpack}[1]{\textsf {#1}} ^^A typeset a package
% \newcommand*{\Lopt}[1]{\textsf {#1}} ^^A typeset an option
% \newcommand*{\file}[1]{\texttt {#1}} ^^A typeset a file
@@ -338,6 +336,19 @@
% \DescribeMacro{\vindent}
% When a verse line is too long to fit within the typeblock it is
% wrapped onto the next line with a space, given by the value of the
+% length \cs{vindent}.
+%
+% \DescribeMacro{\leftmargini}
+% All verse lines have a minimum indent given by the length \cs{leftmargini}
+% which also applies to any list environment. To change the minimum
+% indent for verses do something along the lines:
+% \begin{verbatim}
+% \newlength{\saveleftmargini}
+% \setlength{\saveleftmargini}{\leftmargini}
+% \setlength{\leftmargini}{-1em}% for example to outdent verse
+% % verses
+% \setlength{\leftmargini}{\saveleftmargini}% restore original value
+% \end{verbatim}
%
% \DescribeMacro{\stanzaskip}
% The length |\stanzaskip| controls the spacing between stanzas.
@@ -366,10 +377,22 @@
% any numbering.
%
% \DescribeMacro{\thepoemline}
+% \DescribeMacro{\verselinenumfont}
+% Lines are numbered via \cs{thepoemline} which defaults to typesetting
+% arabic numerals via: \\
+% \verb?\renewcommand*{\thepoemline}{\arabic{poemline}}? \\
+% The particular font is defined by \cs{verselinenumfont}\marg{font-spec}.
+% The default is: \\
+% \verb?\verselinenumfont{\rmfamily}? \\
+%
% \DescribeMacro{\vrightskip}
-% Lines are numbered via |\thepoemline| which defaults to typesetting normal
-% sized arabic numerals. These are typeset at the distance |\vrightskip| into
-% the right margin.
+% \DescribeMacro{\verselinenumbersleft}
+% \DescribeMacro{\verselinenumbersright}
+% By default the numbers are typeset at the distance \cs{vrightskip} into the
+% right margin.
+% If you want line numbers set at the left use the \cs{verselinenumbersleft}
+% declaration. To revert to the default use \cs{verselinenumbersright}.
+%
%
% \DescribeMacro{\\}
% Within the |verse| environment, the macro |\\| must be used at the
@@ -570,27 +593,27 @@
% \poemtitle{In the beginning}
% \settowidth{\versewidth}{And objects at rest tended to remain at rest}
% \begin{verse}[\versewidth]
-% Then God created Newton, \\
-% And objects at rest tended to remain at rest, \\
-% And objects in motion tended to remain in motion, \\
+% Then God created Newton, \\*
+% And objects at rest tended to remain at rest, \\*
+% And objects in motion tended to remain in motion, \\*
% And energy was conserved
% and momentum was conserved
-% and matter was conserved \\
+% and matter was conserved \\*
% And God saw that it was conservative.
% \end{verse}
% \attrib{Possibly from \textit{Analog}, circa 1950}
% \end{verbatim}
%
-% \enlargethispage{\baselineskip}
+% \clearpage
% \poemtitle{In the beginning}
% \settowidth{\versewidth}{And objects at rest tended to remain at rest}
% \begin{verse}[\versewidth]
-% Then God created Newton, \\
-% And objects at rest tended to remain at rest, \\
-% And objects in motion tended to remain in motion, \\
+% Then God created Newton, \\*
+% And objects at rest tended to remain at rest, \\*
+% And objects in motion tended to remain in motion, \\*
% And energy was conserved
% and momentum was conserved
-% and matter was conserved \\
+% and matter was conserved \\*
% And God saw that it was conservative.
% \end{verse}
% \attrib{Possibly from \textit{Analog}, circa 1950}
@@ -876,22 +899,35 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\verselinenumfont}
+% \begin{macro}{\vlvnumfont}
+% Set the font for line numbers.
+% \changes{v2.3}{2006/01/14}{Added \cs{verselinenumfont} and \cs{vlvnumfont}}
+% \begin{macrocode}
+\newcommand*{\verselinenumfont}[1]{\def\vlnumfont{#1}}
+\verselinenumfont{\rmfamily}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
% \begin{macro}{\getmodulo@vs}
% This returns either nothing or a poem line number for printing.
% \changes{v2.0}{2002/03/24}{Added \cs{getmodulo@vs}}
% \begin{macrocode}
-\newcommand{\getmodulo@vs}{{\@tempcnta\c@poemline
+\newcommand{\getmodulo@vs}{\bgroup
+ \@tempcnta\c@poemline
\ifnum\c@modulo@vs<\@ne % no line numbers
\else
\ifnum\c@modulo@vs<\tw@ % number every line
- \thepoemline
+ \vlnumfont\thepoemline
\else
\divide\@tempcnta\c@modulo@vs
\multiply\@tempcnta\c@modulo@vs
- \ifnum\@tempcnta=\c@poemline\thepoemline\fi
+ \ifnum\@tempcnta=\c@poemline\vlnumfont\thepoemline\fi
\fi
\fi
-}}
+\egroup}
% \end{macrocode}
% \end{macro}
@@ -976,12 +1012,14 @@
% \end{macro}
%
% \begin{macro}{\verselinebreak}
-% Break a verse line by inserting |\newline|.
+% Break a verse line by inserting \cs{newline}.\footnote{In an email to me
+% dated 2006/01/13 Aaron Rendahl pointed out that this should include
+% an \cs{ignorespaces}.}
% \changes{v2.0}{2002/03/24}{Modified \cs{verselinebreak}}
% \changes{v2.1}{2002/03/28}{Modified \cs{verselinebreak}}
+% \changes{v2.3}{2006/01/14}{Added \cs{ignorespaces} to \cs{verselinebreak}}
% \begin{macrocode}
-\newcommand{\verselinebreak}[1][\z@]{\newline\hspace*{#1}% extra verseindent
-}
+\newcommand*{\verselinebreak}[1][\z@]{\newline\hspace*{#1}\ignorespaces}
% \end{macrocode}
% \end{macro}
%
@@ -1013,6 +1051,29 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\@vstypelinenumright}
+% \begin{macro}{\@vstypelinenumleft}
+% \begin{macro}{\verselinenumbersright}
+% \begin{macro}{\verselinenumbersleft}
+% These control the typesetting of verse linenumbers to the
+% right and to the left of the verse. Default is to set them at
+% the right.
+% \changes{v2.3}{2006/01/14}{Added left/right switching line numbers}
+% \begin{macrocode}
+\newcommand*{\@vstypelinenumright}{%
+ \hfill\rlap{\kern\vrightskip\kern\rightmargin\getmodulo@vs}}
+\newcommand*{\@vstypelinenumleft}{%
+ \hfill\rlap{\kern-\textwidth\kern-\vrightskip\getmodulo@vs}}
+\newcommand*{\verselinenumbersright}{\def\@vstypelinenum{\@vstypelinenumright}}
+\newcommand*{\verselinenumbersleft}{\def\@vstypelinenum{\@vstypelinenumleft}}
+\verselinenumbersright
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
% \begin{macro}{\@vscentercr}
% This puts the poem line number in the margin, increments
% the line numbers, and then deals with the options. It is based
@@ -1022,11 +1083,13 @@
% \changes{v1.1}{2001/08/03}{Changed definition of \cs{@centercrplus}}
% \changes{v2.0}{2002/03/24}{Renamed \cs{@centercrplus} as \cs{@vscentercr}}
% \changes{v2.0}{2002/03/24}{Major rewrite of \cs{@vscentercr} and friends}
-% \changes{v2.1}{2002/03/28}{Added greater than character to \cs{@vscentercr}}
+% \changes{v2.1}{2002/03/28}{Added greater than character to \cs{@vscentercr}}%
+% \changes{v2.3}{2006/01/14}{Used \cs{@vstypelinenum} in \cs{@vscentercr}}
% \begin{macrocode}
\newcommand{\@vscentercr}{%
\ifhmode \unskip\else \@nolnerr\fi
- \hfill\rlap{\kern\vrightskip\kern\rightmargin\getmodulo@vs}%
+ \@vstypelinenum%
+%%%% \hfill\rlap{\kern\vrightskip\kern\rightmargin\getmodulo@vs}%
% \end{macrocode}
% For |>| call |\verselinebreak| to process it.
% \begin{macrocode}