diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/poetrytex/poetrytex.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/poetrytex/poetrytex.dtx | 131 |
1 files changed, 104 insertions, 27 deletions
diff --git a/Master/texmf-dist/source/latex/poetrytex/poetrytex.dtx b/Master/texmf-dist/source/latex/poetrytex/poetrytex.dtx index 4f3b4e9a722..7761a7a1c21 100644 --- a/Master/texmf-dist/source/latex/poetrytex/poetrytex.dtx +++ b/Master/texmf-dist/source/latex/poetrytex/poetrytex.dtx @@ -53,7 +53,11 @@ %<*driver> \ProvidesFile{poetrytex.dtx} %</driver> -%<poetrytex>\ProvidesPackage{poetrytex} +% +%<*poetrytex> +\NeedsTeXFormat{LaTeX2e}[1994/06/01] +\ProvidesPackage{poetrytex}[2012/10/03] +%</poetrytex>% % %<*driver> \documentclass[a4paper]{ltxdoc} @@ -78,7 +82,7 @@ % \name{Sam Whited}\\ % \texttt{sam@samwhited.com} % } -% \date{\today\\v1.1\githead\gitdirty\gituncommitted} +% \date{\today\\v1.3\githead\gitdirty\gituncommitted} % % \maketitle % \maketoc @@ -135,11 +139,13 @@ % % Before building \pkg{poetrytex} you should verify that the following % dependencies are installed: -% \changes{1.0}{2012/07/18}{Removed fontspec / xelatex dependency} +% \changes{1.0}{2012/07/18}{Removed \pkg{fontspec} / \pkg{xelatex} dependency} +% \changes{1.2}{2012/10/03}{Removed \pkg{parskip} dependency} +% \changes{1.2}{2012/10/03}{Removed default \pkg{hyperref} options} +% \changes{1.3}{2012/10/03}{Load \pkg{hyperref} at end of package} % \begin{macrocode} \RequirePackage{expl3} -\RequirePackage[pdfborder=0, bookmarks, colorlinks=false, hidelinks]{hyperref} -\RequirePackage[parfill]{parskip} +\AtEndOfPackage{\RequirePackage{hyperref}} % \end{macrocode} % Once you have all the required packages, building \pkg{poetrytex} from source % can be accomplished in multiple ways. If the Makefile is present running @@ -158,10 +164,9 @@ % pdflatex --shell-escape poetrytex.dtx % \end{Verbatim} % -% It should be noted that this option is extremely unsafe, and you should only +% It should be noted that this option is extremely unsafe and you should only % use it if you understand the risks. % -% % \paragraph{Loading} % % Using \pkg{poetrytex} in your project works exactly as you'd expect: @@ -170,6 +175,37 @@ % \usepackage{poetrytex} % \end{Verbatim} % +% \hypertarget{POETRYTEX:OPTIONS}{} +% \changes{1.2}{2012/10/03}{Added various package options} +% \begin{macro}{verse} +% \begin{macro}{numbertop} +% \begin{macro}{resetnumongroup} +% \begin{macro}{numberpoems} +% \begin{macro}{clearpageafterpoem} +% The package can also be loaded with any of the following options: +% \begin{macrocode} +\DeclareOption{verse}{\usepackage{verse}} +\DeclareOption{numbertop}{\numbertop} +\DeclareOption{resetnumongroup}{\resetnumongroup} +\DeclareOption{numberpoems}{\numberpoems} +\DeclareOption{clearpageafterpoem}{\clearpageafterpoem} +\DeclareOption{clearpageafterpoems}{\clearpageafterpoem} +\DeclareOption*{% + \PassOptionsToPackage{\CurrentOption}{hyperref}% +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% For instance: +% +% \begin{Verbatim} +% \usepackage[numberpoems,clearpageafterpoem]{poetrytex} +% \end{Verbatim} +% % % \part{Document setup and structure} % @@ -223,6 +259,9 @@ % date we use the \code{\textbackslash pt} equivalents so that we can refer to % them again later, or redefine them throughout the document---in anthologies % with works by multiple authors, for instance. +% +% \subsection{Poem config} +% % \begin{macro}{\@ptpoemlabeltext} % Each time you create a poem in your document we automatically assign it a % special label that can be used to link to it later. This label is prefixed @@ -249,6 +288,25 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\ptdefaultenv} +% \changes{1.2}{2012/09/20}{Added an option to change the default environment} +% This contains the name of the default environment in which we should wrap +% poems. +% \begin{macrocode} +\newcommand*{\ptdefaultenv}{verse} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ptannotationenv} +% \changes{1.3}{2012/10/30}{Added an option to change the default annotation +% environment} +% This contains the name of the default environment in which we should wrap +% annotations. +% \begin{macrocode} +\newcommand*{\ptannotationenv}{flushleft} +% \end{macrocode} +% \end{macro} +% % \subsection{Dedication} % % After your title page you might want to add a dedication page. @@ -356,22 +414,25 @@ % \section{The \code{poem} environment} % % \begin{environment}{poem} +% \changes{1.2}{2012/09/20}{Use \code{hypertarget} instead of \code{label}} % Inserting a poem or other writing into your anthology is accomplished by % wrapping it in the \code{poem} environment. This environment takes in two % arguments, the title and subtitle (or author, date, etc.) of the poem. % \begin{macrocode} -\newenvironment{poem}[3][verse]{% +\newenvironment{poem}[3][\ptdefaultenv]{% % \end{macrocode} % % By default \code{poem} re-wraps your text in the \code{verse} environment. % However, this can be changed by passing in an optional argument with the name -% of another environment to wrap it in (eg. \code{center}). +% of another environment to wrap it in (eg. \code{center}) or, for all poems, by +% redefining \code{ptdefaultenv}. % % \begin{macrocode} \newcommand*{\@ptwrapenvironment}{#1} % \end{macrocode} % For example, a poem wrapped in the \code{center} environment might look like % this: +% % \begin{Example} % \begin{Verbatim} % \begin{poem}[center] @@ -420,7 +481,7 @@ \else% \arabic{poemnum}.\ % \fi#2}% - \label{\@ptpoemlabeltext\arabic{absolutepoemnum}} + \hypertarget{\@ptpoemlabeltext\arabic{absolutepoemnum}}{} {\poemtitleformat% \ifx\@ptnumberpoems\@ptundefined \relax @@ -451,8 +512,8 @@ % \subsection{Headings} % % \begin{macro}{\poetryheadings} -% Every time a new \code{poem} or \code{annotation} environment is created, we -% automatically call \code{\textbackslash poetryheadings}. By redefining this, +% Every time a new \code{poem} or \code{annotation} environment is created we +% automatically call \code{\textbackslash poetryheadings}. By redefining this % you can change how your headings look, use packages like \pkg{fancyhdr}, or % remove headers from poem pages altogether. % \begin{macrocode} @@ -469,10 +530,10 @@ % \begin{macro}{\resetnumongroup} % \begin{macro}{\numberpoems} % These commands determine if the \code{poemnum} counter should be reset when -% the poem group changes, and if the poems should display their number above the -% title. Generally these should be called from the preamble, but they can be -% defined at any point in your document to change how numbering works, or turn -% on numbering from that point forward. +% the poem group changes and if the poems should display their number above the +% title. Generally these should be called from the preamble but they can be +% defined at any point in your document to change how numbering works, or to +% turn on numbering from that point forward. % \begin{macrocode} \newcommand*{\resetnumongroup}{\newcommand*{\@ptresetnumongroup}{}} \newcommand*{\numberpoems}{\newcommand*{\@ptnumberpoems}{}} @@ -480,6 +541,7 @@ % \end{macro} % \end{macro} % Using \code{\textbackslash numberpoems} results in: +% % \begin{Example} % \begin{Verbatim} % \numberpoems @@ -491,7 +553,8 @@ % The moon was a ghostly galleon % tossed upon cloudy seas,\\ % The road was a ribbon of -% moonlight over the purple moor +% moonlight over the purple moor% +% \ldots % \end{poem} % \end{Verbatim} % \columnbreak @@ -503,7 +566,8 @@ % The moon was a ghostly galleon % tossed upon cloudy seas,\\ % The road was a ribbon of -% moonlight over the purple moor +% moonlight over the purple moor% +% \ldots % \end{poem} % \end{Example} % @@ -531,7 +595,7 @@ % The \code{\textbackslash ptgap} length and \code{\textbackslash ptind} % command are two of those places where \pkg{poetrytex} strays a bit into the % realm of poetry typesetting. They overlap with the \pkg{verse} package's -% \code{\textbackslash vgap} and \code{\textbackslash vin} commands, and insert +% \code{\textbackslash vgap} and \code{\textbackslash vin} commands and insert % indentation at at the beginning of a line. This is useful for typesetting % poems consistently when the \pkg{verse} package is not loaded. Redefine % \code{\textbackslash ptgap} to change the length that \code{\textbackslash% @@ -555,7 +619,7 @@ % \end{macro} % % Using it works something like this: -% \clearpage +% % \begin{Example} % \begin{Verbatim} % \setlength{\ptgap}{2em} @@ -592,7 +656,7 @@ % \end{poem} % \end{Example} % -% \subsection{Stylization} +% \subsection{Style} % % \begin{macro}{\poemtitleformat} % By redefining \code{\textbackslash poemtitleformat} we can change how the poem @@ -651,6 +715,7 @@ % \end{macro} % % For example: +% % \begin{Example} % \begin{Verbatim} % \renewcommand{\ptspacerchar}{\o} @@ -707,6 +772,7 @@ % % \begin{macro}{\linktopoem} % \changes{1.1}{2012/07/24}{Fix spacing and multiple use issues} +% \changes{1.2}{2012/09/20}{Use \code{hyperlink} when linking to a poem} % We can \emph{\linktopoem[1]{link}} \emph{\linktopoem[2]{to}}% % \emph{\linktopoem[3]{poems}} easily enough by providing \code{linktopoem} with % the text for the link and, optionally, the number of the poem to link to. If @@ -714,9 +780,9 @@ % \begin{macrocode} \newcommand*{\linktopoem}[2][ptnull]{% \ifx{#1}{ptnull} - \hyperref[\@ptpoemlabeltext#2]{#2}\relax + \hyperlink{\@ptpoemlabeltext#2}{#2}\relax \else - \hyperref[\@ptpoemlabeltext#1]{#2}\relax + \hyperlink{\@ptpoemlabeltext#1}{#2}\relax \fi } % \end{macrocode} @@ -788,10 +854,10 @@ % again after the annotation. % % Like the \code{poetry} environment, an optional first argument can be used to -% specify the environment in which the annotation will be wrapped. This defaults -% to \code{flushleft}. +% specify the environment in which the annotation will be wrapped. The default +% is \code{flushleft} and can be changed by redefining \code{ptannotationenv}. % \begin{macrocode} -\newenvironment{annotation}[2][flushleft]{% +\newenvironment{annotation}[2][\ptannotationenv]{% \newcommand*{\@ptwrapenvironment}{#1} \cleardoublepage \poetryheadings @@ -805,12 +871,17 @@ % \end{macrocode} % \end{environment} % +% Now that everything is defined we can process any +% \hyperlink{POETRYTEX:OPTIONS}{options} that were passed in by the user: % \begin{macrocode} +\ProcessOptions\relax %</poetrytex> % \end{macrocode} % % \clearpage % \setcounter{IndexColumns}{2} +% \phantomsection +% \addcontentsline{toc}{section}{Index} % \PrintIndex % % \makeatletter @@ -820,6 +891,8 @@ % \GlossaryParms \let\item\@idxitem \ignorespaces}{} % \makeatother % \clearpage +% \phantomsection +% \addcontentsline{toc}{section}{Change History} % \PrintChanges % \changes{1.1}{2012/07/19}{Added an example table of poems} % \maketop @@ -830,15 +903,19 @@ % \begin{macrocode} \ProvidesPackage{poetrytex-style} -\usepackage{fancyvrb,hologo,multicol,tipa,url} +\usepackage{fancyvrb,hologo,framed,multicol,tipa,url} +\usepackage[pdfborder=0, bookmarks, colorlinks=false, hidelinks]{hyperref} +\usepackage[parfill]{parskip} \fvset{gobble=2} \newenvironment{Example}{% \begingroup\setlength{\columnseprule}{.4pt} + \begin{minipage}{\textwidth} \begin{multicols}{2} }{ \end{multicols} + \end{minipage} \endgroup } |