%% %% This is file `poetrytex.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% poetrytex.dtx (with options: `poetrytex') %% %% Copyright 2012 Samuel Whited %% %% This file may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either %% version 1.3c of this license or (at your option) any later %% version. The latest version of this license is in: %% %% http://www.latex-project.org/lppl.txt %% %% and version 1.3c or later is part of all distributions of %% LaTeX version 2008/05/04 or later. %% \NeedsTeXFormat{LaTeX2e}[1994/06/01] \ProvidesPackage{poetrytex}[2014/12/12] \RequirePackage{expl3} \RequirePackage{tocloft} \DeclareOption{poemsintoc}{\listpoemsintoc} \DeclareOption{numbertop}{\numbertop} \DeclareOption{numbertoc}{\numbertoc} \DeclareOption{numberpoems}{\numberpoems} \DeclareOption{usedefaulttitles}{\usedefaulttitles} \DeclareOption{useincipits}{\useincipits} \DeclareOption{clearpageafterpoem}{\clearpageafterpoem} \DeclareOption{clearpageafterannotation}{\clearpageafterannotation} \newcommand*{\pttitle}{Title} \newcommand*{\ptsubtitle}{Subtitle} \newcommand*{\ptauthor}{Author} \newcommand*{\ptdate}{\today} \title{% \beforetitle\pttitle\aftertitle% \ifx\ptsubtitle\@ptundefined% \relax% \else% \\*\beforesubtitle\ptsubtitle\aftersubtitle% \fi% } \author{\beforeauthor\ptauthor\afterauthor} \date{\beforedate\ptdate\afterdate} \newcommand*{\@ptpoemlabeltext}{poetrytexpoem:} \newcounter{poemnum} \newcounter{absolutepoemnum} \newcounter{untitledpoemnum} \newcounter{absoluteuntitledpoemnum} \newcounter{titledpoemnum} \newcounter{absolutetitledpoemnum} \newcounter{poemgroupnum} \newlength{\poemvspace} \setlength{\poemvspace}{0em} \newlength{\pttitleleftspace} \setlength{\pttitleleftspace}{0em} \newlength{\pttitlerightspace} \setlength{\pttitlerightspace}{0em} \newlength{\ptsubtitleleftspace} \setlength{\ptsubtitleleftspace}{0em} \newlength{\ptsubtitlerightspace} \setlength{\ptsubtitlerightspace}{0em} \newcommand*{\usedefaulttitles}{\newcommand*{\@ptusedefaulttitles}{}} \newcommand*{\nousedefaulttitles}{\let\@ptusedefaulttitles\@ptundefined} \newcommand*{\ptdefaulttitle}{% Untitled No. \arabic{absoluteuntitledpoemnum}% } \newcommand*{\useincipits}{\newcommand*{\@ptuseincipits}{}} \newcommand*{\nouseincipits}{\let\@ptuseincipits\@ptundefined} \newcommand*{\ptdefaultenv}{verse} \newcommand*{\pttitleenv}{center} \newcommand*{\ptdefaultgroupenv}{center} \newcommand*{\grouppagestyle}{empty} \newlength{\pregroupvspace} \newlength{\postgroupvspace} \setlength{\pregroupvspace}{\fill} \setlength{\postgroupvspace}{\fill} \newcounter{annotationnum} \newcounter{absoluteannotationnum} \newcommand*{\ptannotationenv}{flushleft} \newcommand*{\ptdedication}{Renew \textsf{\textbackslash ptdedication}} \newcommand*{\makededication}[1][flushright]{% \thispagestyle{empty} \vspace*{\prededicationvspace} \begin{#1} \beforededication{\dedicationformat\ptdedication}\afterdedication \end{#1} \vspace*{\postdedicationvspace} } \newcommand*{\resetnumon}{} \newlistof[\resetnumon]{poem}{top}{\topname} \newcommand*{\listofpoems}{\listofpoem} \newcommand*{\topname}{List of Poems} \newcommand*{\topentrytype}{subsection} \newcommand*{\toptocentrytype}{section} \newcommand*{\listpoemsintoc}{\newcommand*{\@ptlistpoemsintoc}{}} \newcommand*{\nolistpoemsintoc}{\let\@ptlistpoemsintoc\@ptundefined} \newcommand*{\tocentrytype}{\topentrytype} \setcounter{secnumdepth}{-1} \setcounter{tocdepth}{2} \renewcommand*{\listtablename}{\topname} \newcommand*{\maketoc}{% \beforetoc \tableofcontents \pagestyle{plain} \aftertoc \clearpage \thispagestyle{empty} } \newcommand*{\maketop}{\@ifstar{\@ptmaketopStar}{\@ptmaketopNoStar}} \newcommand*{\@ptmaketopStar}{% \cleardoublepage \beforetop \listofpoems \pagestyle{plain} \aftertop \clearpage } \newcommand*{\@ptmaketopNoStar}{% \cleardoublepage \beforetop \phantomsection \addcontentsline{toc}{\toptocentrytype}{\topname} \listofpoems \pagestyle{plain} \aftertop \clearpage } \newcommand*{\numbertop}{\newcommand*{\@ptnumbertop}{}} \newcommand*{\numbertoc}{\newcommand*{\@ptnumbertoc}{}} \newcommand*{\nonumbertop}{\let\@ptnumbertop\@ptundefined} \newcommand*{\nonumbertoc}{\let\@ptnumbertoc\@ptundefined} \newcommand*{\beforetitle}{} \newcommand*{\aftertitle}{} \newcommand*{\beforesubtitle}{} \newcommand*{\aftersubtitle}{} \newcommand*{\beforeauthor}{} \newcommand*{\afterauthor}{} \newcommand*{\beforedate}{} \newcommand*{\afterdate}{} \newcommand*{\dedicationformat}{\normalfont\itshape} \newlength{\prededicationvspace} \newlength{\postdedicationvspace} \setlength{\prededicationvspace}{\fill} \setlength{\postdedicationvspace}{\fill} \newcommand*{\beforededication}{} \newcommand*{\afterdedication}{} \newcommand{\beforetoc}{} \newcommand{\aftertoc}{} \newcommand{\beforetop}{} \newcommand{\aftertop}{} \newcommand*{\beforepoemgroup}{\cleardoublepage} \newcommand*{\afterpoemgroup}{\clearpage} \newenvironment{poem}[3][\ptdefaultenv]{% \newcommand*{\@ptwrapenvironment}{#1} \newcommand*{\incipit}{% \@ifstar{% \@ptincipitStar }{% \@ptincipitNoStar } } \newcommand*{\@ptincipitNoStar}[1]{% \global\expandafter\def% \csname% @poem\arabic{absolutepoemnum} incipit% \endcsname{##1}% ##1% } \newcommand*{\@ptincipitStar}[1]{% \global\expandafter\def% \csname% @poem\arabic{absolutepoemnum} incipit% \endcsname{##1}% } \newcommand*{\theincipit}{% \csname @poem\arabic{absolutepoemnum} incipit\endcsname% } \addtocounter{poemnum}{1} \addtocounter{absolutepoemnum}{1} \poetryheadings \ifx&% \addtocounter{untitledpoemnum}{1} \addtocounter{absoluteuntitledpoemnum}{1} \else \addtocounter{titledpoemnum}{1} \addtocounter{absolutetitledpoemnum}{1} \fi \vspace*{\poemvspace} \begin{\pttitleenv} \refstepcounter{poem}% \phantomsection% \addcontentsline{top}{\topentrytype}{% \ifx\@ptnumbertop\@ptundefined% \relax% \else% \toppoemnum% \fi% \ifx&% \ifx\@ptuseincipits\@ptundefined% \ptdefaulttitle% \else% {\incipittopformat \theincipit}% \fi% \else% #2% \fi% }% \ifx\@ptlistpoemsintoc\@ptundefined% \relax% \else% \addcontentsline{toc}{\tocentrytype}{% \ifx\@ptnumbertoc\@ptundefined% \relax% \else% \tocpoemnum% \fi% \ifx&% \ifx\@ptuseincipits\@ptundefined% \ptdefaulttitle% \else% {\incipittocformat \theincipit}% \fi% \else% #2% \fi% }% \fi% \ifx\hypertarget\@ptundefined% \relax% \else% \hypertarget{\@ptpoemlabeltext\arabic{absolutepoemnum}}{}% \fi% {\poemtitleformat% \ifx\@ptnumberpoems\@ptundefined \relax \else \titlepoemnum \fi% \ifx&% \ifx\@ptusedefaulttitles\@ptundefined% \relax% \else% \hspace*{\pttitleleftspace}\ptdefaulttitle% \hspace*{\pttitlerightspace}\\*% \fi% \else \hspace*{\pttitleleftspace}#2\hspace*{\pttitlerightspace}\\*% \fi% }% \hspace*{\ptsubtitleleftspace}#3\hspace*{\ptsubtitlerightspace} \end{\pttitleenv} \nopagebreak \begin{\@ptwrapenvironment} \begingroup\setlength{\parskip}{\stanzaparskip}% }{% \endgroup \end{\@ptwrapenvironment}% \ifx\@ptclearpageafterpoem\@ptundefined% \relax% \else% \clearpage% \fi% } \newcommand*{\poetryheadings}[0]{% \pagestyle{myheadings} \markboth{\ |\ \textsc{\pttitle}\hfill } {\hfill\textsc{\ptgroup}\ |\ } } \newcommand*{\numberpoems}{\newcommand*{\@ptnumberpoems}{}} \newcommand*{\nonumberpoems}{\let\@ptnumberpoems\@ptundefined} \newcommand*{\titlepoemnum}{\arabic{absolutepoemnum}\\*} \newcommand*{\toppoemnum}{\arabic{absolutepoemnum}.\ } \newcommand*{\tocpoemnum}{\toppoemnum} \newlength{\stanzaparskip} \setlength{\stanzaparskip}{0.7em} \newcommand*{\clearpageafterpoem}{\newcommand*{\@ptclearpageafterpoem}{}} \newcommand*{\clearpageafterannotation}{\newcommand*{\@ptclearpageafterannotation}{}} \newcommand*{\noclearpageafterpoem}{\let\@ptclearpageafterpoem\@ptundefined} \newcommand*{\noclearpageafterannotation}{\let\@ptclearpageafterannotation\@ptundefined} \newlength{\ptgap} \setlength{\ptgap}{2em} \newcommand*{\ptind}{% \@ifstar{% \@ptindStar }{% \@ptindNoStar } } \newcommand*{\@ptindStar}{\hspace*{\ptgap}} \newcommand*{\@ptindNoStar}{\hspace{\ptgap}} \newcommand*{\poemtitleformat}{\normalfont\bfseries\large} \newcommand*{\incipittopformat}{\itshape} \newcommand*{\incipittocformat}{\incipittopformat} \newlength{\ptspacergap} \setlength{\ptspacergap}{4em} \newcommand*{\ptspacerchar}{\S} \newcounter{ptspacernum} \newcommand*{\ptspacer}{% \@ifstar{% \@ptspacerStar }{% \@ptspacerNoStar } } \newcommand*{\@ptspacerStar}{% \hspace*{\ptspacergap}% \@ptrepeat{\value{ptspacernum}}{\ptspacerchar}% } \newcommand*{\@ptspacerNoStar}{% \hspace{\ptspacergap}% \@ptrepeat{\value{ptspacernum}}{\ptspacerchar}% } \ExplSyntaxOn \cs_new_eq:NN \@ptrepeat \prg_replicate:nn \ExplSyntaxOff \newcommand*{\linktopoem}[2][ptnull]{% \ifx\hyperlink\@ptundefined #2\relax% \else \ifx{#1}{ptnull} \hyperlink{\@ptpoemlabeltext#2}{#2}\relax \else \hyperlink{\@ptpoemlabeltext#1}{#2}\relax \fi \fi } \newcommand*{\ptgroup}{} \newcommand*{\poemgroup}[1]{% \addtocounter{poemgroupnum}{1} \setcounter{poemnum}{0} \setcounter{untitledpoemnum}{0} \setcounter{titledpoemnum}{0} \setcounter{annotationnum}{0} \beforepoemgroup \vspace*{\pregroupvspace} \renewcommand*{\ptgroup}{#1} \pagestyle{\grouppagestyle} \begin{\ptdefaultgroupenv} \@ifstar{% \@ptpoemgroupStar{#1} }{% \@ptpoemgroupNoStar{#1} } \end{\ptdefaultgroupenv} \vspace*{\postgroupvspace} \afterpoemgroup } \newcommand*{\@ptpoemgroupStar}[1]{% \section*{#1} } \newcommand*{\@ptpoemgroupNoStar}[1]{% \section{#1} \addcontentsline{top}{section}{#1} } \newcommand*{\setpoemgroup}[1]{% \addtocounter{poemgroupnum}{1} \setcounter{poemnum}{0} \setcounter{untitledpoemnum}{0} \setcounter{titledpoemnum}{0} \setcounter{annotationnum}{0} \renewcommand*{\ptgroup}{#1} \@ifstar{% \relax% }{% \@ptsetpoemgroupNoStar{#1} } } \newcommand*{\@ptsetpoemgroupNoStar}[1]{% \addcontentsline{top}{section}{#1} \addcontentsline{toc}{section}{#1} } \newenvironment{annotation}[2][\ptannotationenv]{% \newcommand*{\@ptwrapenvironment}{#1} \cleardoublepage \addtocounter{annotationnum}{1} \addtocounter{absoluteannotationnum}{1} \annotationheadings \begin{\@ptwrapenvironment} \subsection{#2} \nopagebreak }{% \end{\@ptwrapenvironment}% \ifx\@ptclearpageafterannotation\@ptundefined% \relax% \else% \clearpage% \fi% } \newcommand*{\annotationheadings}[0]{\poetryheadings} \ProcessOptions\relax %% %% ___________ %% Maintainer: Sam Whited %% Website: https://blog.samwhited.com %% Contact: sam@samwhited.com %% Public key: 0x54083AE104EA7AD3 %% %% This work consists of this file poetrytex.dtx %% and the derived files poetrytex.sty %% and poetrytex.pdf %% %% %% End of file `poetrytex.sty'.