summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/poetrytex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-12-12 23:11:04 +0000
committerKarl Berry <karl@freefriends.org>2014-12-12 23:11:04 +0000
commit35e43230f4164d6cd6df0258ea993101bcb6b5ef (patch)
tree70df22455f252619c28f3d64e32230e3ce2e199b /Master/texmf-dist/tex/latex/poetrytex
parent9a0113b42082225c611243ab9dbfecf28bcc1923 (diff)
poetrytex (12dec14)
git-svn-id: svn://tug.org/texlive/trunk@35807 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/poetrytex')
-rw-r--r--Master/texmf-dist/tex/latex/poetrytex/poetrytex.sty111
1 files changed, 67 insertions, 44 deletions
diff --git a/Master/texmf-dist/tex/latex/poetrytex/poetrytex.sty b/Master/texmf-dist/tex/latex/poetrytex/poetrytex.sty
index ee7e12930c1..e4c79e7a258 100644
--- a/Master/texmf-dist/tex/latex/poetrytex/poetrytex.sty
+++ b/Master/texmf-dist/tex/latex/poetrytex/poetrytex.sty
@@ -19,23 +19,17 @@
%% LaTeX version 2008/05/04 or later.
%%
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
-\ProvidesPackage{poetrytex}[2013/08/17]
+\ProvidesPackage{poetrytex}[2014/12/12]
\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{usedefaulttitles}{\usedefaulttitles}
+\DeclareOption{useincipits}{\useincipits}
\DeclareOption{clearpageafterpoem}{\clearpageafterpoem}
-\DeclareOption{clearpageafterpoems}{\clearpageafterpoem}
-\DeclareOption*{%
- \PassOptionsToPackage{\CurrentOption}{hyperref}%
-}
+\DeclareOption{clearpageafterannotation}{\clearpageafterannotation}
\newcommand*{\pttitle}{Title}
\newcommand*{\ptsubtitle}{Subtitle}
\newcommand*{\ptauthor}{Author}
@@ -68,11 +62,13 @@
\setlength{\ptsubtitleleftspace}{0em}
\newlength{\ptsubtitlerightspace}
\setlength{\ptsubtitlerightspace}{0em}
-\newcommand*{\ptusedefaulttitles}{\newcommand*{\@ptusedefaulttitles}{}}
+\newcommand*{\usedefaulttitles}{\newcommand*{\@ptusedefaulttitles}{}}
+\newcommand*{\nousedefaulttitles}{\let\@ptusedefaulttitles\@ptundefined}
\newcommand*{\ptdefaulttitle}{%
Untitled No. \arabic{absoluteuntitledpoemnum}%
}
-\newcommand*{\ptuseincipits}{\newcommand*{\@ptuseincipits}{}}
+\newcommand*{\useincipits}{\newcommand*{\@ptuseincipits}{}}
+\newcommand*{\nouseincipits}{\let\@ptuseincipits\@ptundefined}
\newcommand*{\ptdefaultenv}{verse}
\newcommand*{\pttitleenv}{center}
\newcommand*{\ptdefaultgroupenv}{center}
@@ -100,6 +96,7 @@
\newcommand*{\topentrytype}{subsection}
\newcommand*{\toptocentrytype}{section}
\newcommand*{\listpoemsintoc}{\newcommand*{\@ptlistpoemsintoc}{}}
+\newcommand*{\nolistpoemsintoc}{\let\@ptlistpoemsintoc\@ptundefined}
\newcommand*{\tocentrytype}{\topentrytype}
\setcounter{secnumdepth}{-1}
\setcounter{tocdepth}{2}
@@ -133,6 +130,8 @@
}
\newcommand*{\numbertop}{\newcommand*{\@ptnumbertop}{}}
\newcommand*{\numbertoc}{\newcommand*{\@ptnumbertoc}{}}
+\newcommand*{\nonumbertop}{\let\@ptnumbertop\@ptundefined}
+\newcommand*{\nonumbertoc}{\let\@ptnumbertoc\@ptundefined}
\newcommand*{\beforetitle}{}
\newcommand*{\aftertitle}{}
\newcommand*{\beforesubtitle}{}
@@ -230,7 +229,11 @@
\fi%
}%
\fi%
- \hypertarget{\@ptpoemlabeltext\arabic{absolutepoemnum}}{}
+ \ifx\hypertarget\@ptundefined%
+ \relax%
+ \else%
+ \hypertarget{\@ptpoemlabeltext\arabic{absolutepoemnum}}{}%
+ \fi%
{\poemtitleformat%
\ifx\@ptnumberpoems\@ptundefined
\relax
@@ -255,29 +258,29 @@
\begingroup\setlength{\parskip}{\stanzaparskip}%
}{%
\endgroup
- \end{\@ptwrapenvironment}
- \ifx\@ptclearpageafterpoem\@ptundefined
- \relax
- \else
- \clearpage
- \fi
+ \end{\@ptwrapenvironment}%
+ \ifx\@ptclearpageafterpoem\@ptundefined%
+ \relax%
+ \else%
+ \clearpage%
+ \fi%
}
\newcommand*{\poetryheadings}[0]{%
\pagestyle{myheadings}
\markboth{\ |\ \textsc{\pttitle}\hfill }
{\hfill\textsc{\ptgroup}\ |\ }
}
-\newcommand*{\resetnumongroup}{%
- \newcommand*{\@ptresetnumongroup}{}%
- \renewcommand*{\resetnumon}{poemgroupnum}%
-}
\newcommand*{\numberpoems}{\newcommand*{\@ptnumberpoems}{}}
-\newcommand*{\titlepoemnum}{\arabic{poemnum}\\*}
-\newcommand*{\toppoemnum}{\arabic{poemnum}.\ }
+\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}{%
@@ -295,7 +298,7 @@
\newlength{\ptspacergap}
\setlength{\ptspacergap}{4em}
\newcommand*{\ptspacerchar}{\S}
-\newcommand*{\ptspacernum}{3}
+\newcounter{ptspacernum}
\newcommand*{\ptspacer}{%
\@ifstar{%
\@ptspacerStar
@@ -305,33 +308,33 @@
}
\newcommand*{\@ptspacerStar}{%
\hspace*{\ptspacergap}%
- \@ptrepeat{\ptspacernum}{\ptspacerchar}%
+ \@ptrepeat{\value{ptspacernum}}{\ptspacerchar}%
}
\newcommand*{\@ptspacerNoStar}{%
\hspace{\ptspacergap}%
- \@ptrepeat{\ptspacernum}{\ptspacerchar}%
+ \@ptrepeat{\value{ptspacernum}}{\ptspacerchar}%
}
\ExplSyntaxOn
\cs_new_eq:NN \@ptrepeat \prg_replicate:nn
\ExplSyntaxOff
\newcommand*{\linktopoem}[2][ptnull]{%
- \ifx{#1}{ptnull}
- \hyperlink{\@ptpoemlabeltext#2}{#2}\relax
+ \ifx\hyperlink\@ptundefined
+ #2\relax%
\else
- \hyperlink{\@ptpoemlabeltext#1}{#2}\relax
+ \ifx{#1}{ptnull}
+ \hyperlink{\@ptpoemlabeltext#2}{#2}\relax
+ \else
+ \hyperlink{\@ptpoemlabeltext#1}{#2}\relax
+ \fi
\fi
}
\newcommand*{\ptgroup}{}
\newcommand*{\poemgroup}[1]{%
\addtocounter{poemgroupnum}{1}
- \ifx\@ptresetnumongroup\@ptundefined
- \relax
- \else
- \setcounter{poemnum}{0}
- \setcounter{untitledpoemnum}{0}
- \setcounter{titledpoemnum}{0}
- \setcounter{annotationnum}{0}
- \fi
+ \setcounter{poemnum}{0}
+ \setcounter{untitledpoemnum}{0}
+ \setcounter{titledpoemnum}{0}
+ \setcounter{annotationnum}{0}
\beforepoemgroup
\vspace*{\pregroupvspace}
\renewcommand*{\ptgroup}{#1}
@@ -353,6 +356,23 @@
\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
@@ -363,18 +383,21 @@
\subsection{#2}
\nopagebreak
}{%
-
- \end{\@ptwrapenvironment}
- \clearpage
+ \end{\@ptwrapenvironment}%
+ \ifx\@ptclearpageafterannotation\@ptundefined%
+ \relax%
+ \else%
+ \clearpage%
+ \fi%
}
\newcommand*{\annotationheadings}[0]{\poetryheadings}
\ProcessOptions\relax
%%
%% ___________
%% Maintainer: Sam Whited
-%% Website: https://samwhited.com
+%% Website: https://blog.samwhited.com
%% Contact: sam@samwhited.com
-%% Public key: 0xEC2C9934
+%% Public key: 0x54083AE104EA7AD3
%%
%% This work consists of this file poetrytex.dtx
%% and the derived files poetrytex.sty