diff options
author | Karl Berry <karl@freefriends.org> | 2013-08-18 23:32:51 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-08-18 23:32:51 +0000 |
commit | 3abd327d4999d888117813572f0c8b46bceb1dba (patch) | |
tree | c166b4de7c2499fab520a4a34492403e45eb465e /Master/texmf-dist/tex/latex/poetrytex | |
parent | f917dbdfae2021d592989828a2993fa2b4a78aae (diff) |
poetrytex (18aug13)
git-svn-id: svn://tug.org/texlive/trunk@31463 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/poetrytex')
-rw-r--r-- | Master/texmf-dist/tex/latex/poetrytex/poetrytex.sty | 178 |
1 files changed, 124 insertions, 54 deletions
diff --git a/Master/texmf-dist/tex/latex/poetrytex/poetrytex.sty b/Master/texmf-dist/tex/latex/poetrytex/poetrytex.sty index 7dea683048c..3b8ccb7512e 100644 --- a/Master/texmf-dist/tex/latex/poetrytex/poetrytex.sty +++ b/Master/texmf-dist/tex/latex/poetrytex/poetrytex.sty @@ -21,12 +21,16 @@ \NeedsTeXFormat{LaTeX2e}[1994/06/01] \ProvidesPackage{poetrytex}[2013/02/13] \RequirePackage{expl3} +\RequirePackage{tocloft} \AtEndOfPackage{\RequirePackage{hyperref}} \DeclareOption{verse}{\usepackage{verse}} +\DeclareOption{poemsintoc}{\listpoemsintoc} \DeclareOption{numbertop}{\numbertop} +\DeclareOption{numbertoc}{\numbertoc} \DeclareOption{resetnumongroup}{\resetnumongroup} \DeclareOption{numberpoems}{\numberpoems} \DeclareOption{usedefaulttitles}{\ptusedefaulttitles} +\DeclareOption{useincipits}{\ptuseincipits} \DeclareOption{clearpageafterpoem}{\clearpageafterpoem} \DeclareOption{clearpageafterpoems}{\clearpageafterpoem} \DeclareOption*{% @@ -37,16 +41,21 @@ \newcommand*{\ptauthor}{Author} \newcommand*{\ptdate}{\today} \title{% - \pttitle% - \ifx\ptsubtitle\@ptundefined\relax\else\\\ptsubtitle\fi% + \beforetitle\pttitle\aftertitle% + \ifx\ptsubtitle\@ptundefined% + \relax% + \else% + \\*\beforesubtitle\ptsubtitle\aftersubtitle% + \fi% } -\author{\ptauthor} -\date{\ptdate} +\author{\beforeauthor\ptauthor\afterauthor} +\date{\beforedate\ptdate\afterdate} \newcommand*{\@ptpoemlabeltext}{poetrytexpoem:} \newcounter{poemnum} \newcounter{absolutepoemnum} \newcounter{untitledpoemnum} \newcounter{absoluteuntitledpoemnum} +\newcounter{poemgroupnum} \newlength{\poemvspace} \setlength{\poemvspace}{0em} \newlength{\pttitleleftspace} @@ -61,27 +70,36 @@ \newcommand*{\ptdefaulttitle}{% Untitled No. \arabic{absoluteuntitledpoemnum}% } +\newcommand*{\ptuseincipits}{\newcommand*{\@ptuseincipits}{}} \newcommand*{\ptdefaultenv}{verse} \newcommand*{\pttitleenv}{center} +\newcommand*{\ptdefaultgroupenv}{center} +\newcommand*{\grouppagestyle}{empty} +\newlength{\pregroupvspace} +\newlength{\postgroupvspace} +\setlength{\pregroupvspace}{\fill} +\setlength{\postgroupvspace}{\fill} \newcommand*{\ptannotationenv}{flushleft} \newcommand*{\ptdedication}{Renew \textsf{\textbackslash ptdedication}} \newcommand*{\makededication}[1][flushright]{% \thispagestyle{empty} - \vspace*{\fill} + \vspace*{\prededicationvspace} \begin{#1} - \emph{\ptdedication} + \beforededication{\dedicationformat\ptdedication}\afterdedication \end{#1} - \vspace*{\fill} + \vspace*{\postdedicationvspace} } -\newcommand*{\toptitle}{List of Poems} +\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*{\tocentrytype}{\topentrytype} \setcounter{secnumdepth}{-1} \setcounter{tocdepth}{2} -\renewcommand*{\listtablename}{\toptitle} -\newcommand{\beforetoc}{} -\newcommand{\aftertoc}{} -\newcommand{\beforetop}{} -\newcommand{\aftertop}{} +\renewcommand*{\listtablename}{\topname} \newcommand*{\maketoc}{% \beforetoc \tableofcontents @@ -94,7 +112,7 @@ \newcommand*{\@ptmaketopStar}{% \cleardoublepage \beforetop - \listoftables + \listofpoems \pagestyle{plain} \aftertop \clearpage @@ -103,15 +121,47 @@ \cleardoublepage \beforetop \phantomsection - \addcontentsline{toc}{section}{\toptitle} - \listoftables + \addcontentsline{toc}{\toptocentrytype}{\topname} + \listofpoems \pagestyle{plain} \aftertop \clearpage } \newcommand*{\numbertop}{\newcommand*{\@ptnumbertop}{}} +\newcommand*{\numbertoc}{\newcommand*{\@ptnumbertoc}{}} +\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} +\newcommand*{\theincipit}{% + \csname @poem\arabic{absolutepoemnum} incipit\endcsname% +} \newenvironment{poem}[3][\ptdefaultenv]{% \newcommand*{\@ptwrapenvironment}{#1} +\newcommand*{\incipit}[1]{% + \global\expandafter\def% + \csname% + @poem\arabic{absolutepoemnum} incipit% + \endcsname{##1}% + ##1% +} \poetryheadings \addtocounter{poemnum}{1} \addtocounter{absolutepoemnum}{1} @@ -121,19 +171,44 @@ \fi \vspace*{\poemvspace} \begin{\pttitleenv} + \refstepcounter{poem}% \phantomsection% - \addcontentsline{lot}{\topentrytype}{% + \addcontentsline{top}{\topentrytype}{% \ifx\@ptnumbertop\@ptundefined% \relax% \else% \toppoemnum% \fi% \ifx&% - \ptdefaulttitle% + \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% \hypertarget{\@ptpoemlabeltext\arabic{absolutepoemnum}}{} {\poemtitleformat% \ifx\@ptnumberpoems\@ptundefined @@ -146,14 +221,15 @@ \relax% \else% \hspace*{\pttitleleftspace}\ptdefaulttitle% - \hspace*{\pttitlerightspace}\\% + \hspace*{\pttitlerightspace}\\*% \fi% \else - \hspace*{\pttitleleftspace}#2\hspace*{\pttitlerightspace}\\% + \hspace*{\pttitleleftspace}#2\hspace*{\pttitlerightspace}\\*% \fi% }% \hspace*{\ptsubtitleleftspace}#3\hspace*{\ptsubtitlerightspace} \end{\pttitleenv} + \nopagebreak \begin{\@ptwrapenvironment} \begingroup\setlength{\parskip}{\stanzaparskip}% }{% @@ -170,10 +246,14 @@ \markboth{\ |\ \textsc{\pttitle}\hfill } {\hfill\textsc{\ptgroup}\ |\ } } -\newcommand*{\resetnumongroup}{\newcommand*{\@ptresetnumongroup}{}} +\newcommand*{\resetnumongroup}{% + \newcommand*{\@ptresetnumongroup}{}% + \renewcommand*{\resetnumon}{poemgroupnum}% +} \newcommand*{\numberpoems}{\newcommand*{\@ptnumberpoems}{}} -\newcommand*{\titlepoemnum}{\arabic{poemnum}\\} +\newcommand*{\titlepoemnum}{\arabic{poemnum}\\*} \newcommand*{\toppoemnum}{\arabic{poemnum}.\ } +\newcommand*{\tocpoemnum}{\toppoemnum} \newlength{\stanzaparskip} \setlength{\stanzaparskip}{0.7em} \newcommand*{\clearpageafterpoem}{\newcommand*{\@ptclearpageafterpoem}{}} @@ -189,6 +269,8 @@ \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} @@ -219,47 +301,34 @@ \fi } \newcommand*{\ptgroup}{} -\newcommand*{\poemgroup}{% - \@ifstar{% - \@ptpoemgroupStar - }{% - \@ptpoemgroupNoStar - } -} -\newcommand*{\@ptpoemgroupStar}[1]{% +\newcommand*{\poemgroup}[1]{% + \addtocounter{poemgroupnum}{1} \ifx\@ptresetnumongroup\@ptundefined \relax \else \setcounter{poemnum}{0} \setcounter{untitledpoemnum}{0} \fi - \cleardoublepage - \vspace*{\fill} + \beforepoemgroup + \vspace*{\pregroupvspace} \renewcommand*{\ptgroup}{#1} - \pagestyle{empty} - \begin{center} - \section*{#1} - \end{center} - \vspace*{\fill} - \clearpage + \pagestyle{\grouppagestyle} + \begin{\ptdefaultgroupenv} + \@ifstar{% + \@ptpoemgroupStar{#1} + }{% + \@ptpoemgroupNoStar{#1} + } + \end{\ptdefaultgroupenv} + \vspace*{\postgroupvspace} + \afterpoemgroup +} +\newcommand*{\@ptpoemgroupStar}[1]{% + \section*{#1} } \newcommand*{\@ptpoemgroupNoStar}[1]{% - \ifx\@ptresetnumongroup\@ptundefined - \relax - \else - \setcounter{poemnum}{0} - \setcounter{untitledpoemnum}{0} - \fi - \cleardoublepage - \vspace*{\fill} - \renewcommand*{\ptgroup}{#1} - \pagestyle{empty} - \begin{center} - \section{#1} - \addcontentsline{lot}{section}{#1} - \end{center} - \vspace*{\fill} - \clearpage + \section{#1} + \addcontentsline{top}{section}{#1} } \newenvironment{annotation}[2][\ptannotationenv]{% \newcommand*{\@ptwrapenvironment}{#1} @@ -267,6 +336,7 @@ \poetryheadings \begin{\@ptwrapenvironment} \subsection{#2} + \nopagebreak }{% \end{\@ptwrapenvironment} |