From 6dbb8dfbb59d7e98e7addb0feae7ff9306c49b0e Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Mon, 11 Mar 2013 23:31:14 +0000
Subject: poetrytex (10mar13)

git-svn-id: svn://tug.org/texlive/trunk@29347 c570f23f-e606-0410-a88d-b1316a301751
---
 .../texmf-dist/tex/latex/poetrytex/poetrytex.sty   | 81 ++++++++++++++++++----
 1 file changed, 68 insertions(+), 13 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/poetrytex/poetrytex.sty')

diff --git a/Master/texmf-dist/tex/latex/poetrytex/poetrytex.sty b/Master/texmf-dist/tex/latex/poetrytex/poetrytex.sty
index 7dbc5a63eef..7dea683048c 100644
--- a/Master/texmf-dist/tex/latex/poetrytex/poetrytex.sty
+++ b/Master/texmf-dist/tex/latex/poetrytex/poetrytex.sty
@@ -19,13 +19,14 @@
 %%   LaTeX version 2008/05/04 or later.
 %% 
 \NeedsTeXFormat{LaTeX2e}[1994/06/01]
-\ProvidesPackage{poetrytex}[2012/10/03]
+\ProvidesPackage{poetrytex}[2013/02/13]
 \RequirePackage{expl3}
 \AtEndOfPackage{\RequirePackage{hyperref}}
 \DeclareOption{verse}{\usepackage{verse}}
 \DeclareOption{numbertop}{\numbertop}
 \DeclareOption{resetnumongroup}{\resetnumongroup}
 \DeclareOption{numberpoems}{\numberpoems}
+\DeclareOption{usedefaulttitles}{\ptusedefaulttitles}
 \DeclareOption{clearpageafterpoem}{\clearpageafterpoem}
 \DeclareOption{clearpageafterpoems}{\clearpageafterpoem}
 \DeclareOption*{%
@@ -44,7 +45,24 @@
 \newcommand*{\@ptpoemlabeltext}{poetrytexpoem:}
 \newcounter{poemnum}
 \newcounter{absolutepoemnum}
+\newcounter{untitledpoemnum}
+\newcounter{absoluteuntitledpoemnum}
+\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*{\ptusedefaulttitles}{\newcommand*{\@ptusedefaulttitles}{}}
+\newcommand*{\ptdefaulttitle}{%
+  Untitled No. \arabic{absoluteuntitledpoemnum}%
+}
 \newcommand*{\ptdefaultenv}{verse}
+\newcommand*{\pttitleenv}{center}
 \newcommand*{\ptannotationenv}{flushleft}
 \newcommand*{\ptdedication}{Renew \textsf{\textbackslash ptdedication}}
 \newcommand*{\makededication}[1][flushright]{%
@@ -60,24 +78,35 @@
 \setcounter{secnumdepth}{-1}
 \setcounter{tocdepth}{2}
 \renewcommand*{\listtablename}{\toptitle}
+\newcommand{\beforetoc}{}
+\newcommand{\aftertoc}{}
+\newcommand{\beforetop}{}
+\newcommand{\aftertop}{}
 \newcommand*{\maketoc}{%
+  \beforetoc
   \tableofcontents
   \pagestyle{plain}
+  \aftertoc
   \clearpage
   \thispagestyle{empty}
 }
 \newcommand*{\maketop}{\@ifstar{\@ptmaketopStar}{\@ptmaketopNoStar}}
 \newcommand*{\@ptmaketopStar}{%
+  \cleardoublepage
+  \beforetop
   \listoftables
   \pagestyle{plain}
+  \aftertop
   \clearpage
 }
 \newcommand*{\@ptmaketopNoStar}{%
   \cleardoublepage
+  \beforetop
   \phantomsection
   \addcontentsline{toc}{section}{\toptitle}
   \listoftables
   \pagestyle{plain}
+  \aftertop
   \clearpage
 }
 \newcommand*{\numbertop}{\newcommand*{\@ptnumbertop}{}}
@@ -86,27 +115,49 @@
   \poetryheadings
   \addtocounter{poemnum}{1}
   \addtocounter{absolutepoemnum}{1}
-  \begin{center}
+  \ifx&#2&%
+    \addtocounter{untitledpoemnum}{1}
+    \addtocounter{absoluteuntitledpoemnum}{1}
+  \fi
+  \vspace*{\poemvspace}
+  \begin{\pttitleenv}
     \phantomsection%
     \addcontentsline{lot}{\topentrytype}{%
       \ifx\@ptnumbertop\@ptundefined%
         \relax%
       \else%
-        \arabic{poemnum}.\ %
-      \fi#2}%
+        \toppoemnum%
+      \fi%
+      \ifx&#2&%
+        \ptdefaulttitle%
+      \else%
+        #2%
+      \fi%
+    }%
     \hypertarget{\@ptpoemlabeltext\arabic{absolutepoemnum}}{}
     {\poemtitleformat%
       \ifx\@ptnumberpoems\@ptundefined
         \relax
       \else
-        \arabic{poemnum}\\%
-      \fi#2}\\%
-    #3
-  \end{center}
+        \titlepoemnum
+      \fi%
+      \ifx&#2&%
+        \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}
   \begin{\@ptwrapenvironment}
-  \begingroup\setlength{\parskip}{\stanzaparskip}
+    \begingroup\setlength{\parskip}{\stanzaparskip}%
 }{%
-  \endgroup
+    \endgroup
   \end{\@ptwrapenvironment}
   \ifx\@ptclearpageafterpoem\@ptundefined
     \relax
@@ -116,11 +167,13 @@
 }
 \newcommand*{\poetryheadings}[0]{%
   \pagestyle{myheadings}
-  \markboth{ | \MakeUppercase{\pttitle}\hfill }
-           {\hfill\MakeUppercase{\ptgroup}\ | }
+  \markboth{\ |\ \textsc{\pttitle}\hfill }
+           {\hfill\textsc{\ptgroup}\ |\ }
 }
 \newcommand*{\resetnumongroup}{\newcommand*{\@ptresetnumongroup}{}}
 \newcommand*{\numberpoems}{\newcommand*{\@ptnumberpoems}{}}
+\newcommand*{\titlepoemnum}{\arabic{poemnum}\\}
+\newcommand*{\toppoemnum}{\arabic{poemnum}.\ }
 \newlength{\stanzaparskip}
 \setlength{\stanzaparskip}{0.7em}
 \newcommand*{\clearpageafterpoem}{\newcommand*{\@ptclearpageafterpoem}{}}
@@ -135,7 +188,7 @@
 }
 \newcommand*{\@ptindStar}{\hspace*{\ptgap}}
 \newcommand*{\@ptindNoStar}{\hspace{\ptgap}}
-\newcommand*{\poemtitleformat}{\normalfont\bfseries\large\centering}
+\newcommand*{\poemtitleformat}{\normalfont\bfseries\large}
 \newlength{\ptspacergap}
 \setlength{\ptspacergap}{4em}
 \newcommand*{\ptspacerchar}{\S}
@@ -178,6 +231,7 @@
     \relax
   \else
     \setcounter{poemnum}{0}
+    \setcounter{untitledpoemnum}{0}
   \fi
   \cleardoublepage
   \vspace*{\fill}
@@ -194,6 +248,7 @@
     \relax
   \else
     \setcounter{poemnum}{0}
+    \setcounter{untitledpoemnum}{0}
   \fi
   \cleardoublepage
   \vspace*{\fill}
-- 
cgit v1.2.3

