diff options
author | Karl Berry <karl@freefriends.org> | 2012-07-23 21:56:32 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-07-23 21:56:32 +0000 |
commit | baf6e36c7179e4135cda6aab4261065477e55771 (patch) | |
tree | a643fa7482881346069ed809e743b05003f70d62 /Master/texmf-dist/source/latex/poetrytex | |
parent | 39e4a2a8cc8101a8d081d6973afdb83591b06e58 (diff) |
poetrytex (23jul12)
git-svn-id: svn://tug.org/texlive/trunk@27117 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/poetrytex')
-rw-r--r-- | Master/texmf-dist/source/latex/poetrytex/Makefile | 171 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/poetrytex/poetrytex.dtx | 831 |
2 files changed, 1002 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/poetrytex/Makefile b/Master/texmf-dist/source/latex/poetrytex/Makefile new file mode 100644 index 00000000000..57b2ebeabf6 --- /dev/null +++ b/Master/texmf-dist/source/latex/poetrytex/Makefile @@ -0,0 +1,171 @@ +# Makefile for poetrytex. +# Copied almost exactly from the fontspec makefile. + +#### MAKEFILE CONFIG #### + +SHELL = /bin/sh +.SUFFIXES: +.SILENT: + +#### BEGIN #### + +help: + @echo 'POETRYTEX makefile targets:' + @echo ' ' + @echo ' help - (this message)' + @echo ' unpack - extracts all files' + @echo ' doc - compile documentation' + @echo ' gendoc - compile git-aware documentation' + @echo ' ctan - generate archive for CTAN' + @echo ' all - unpack & doc' + @echo ' world - all & ctan' + @echo ' clean - remove all generated and built files' + @echo ' ' + @echo ' install - install the complete package into your home texmf tree' + @echo ' sty-install - install the package code only' + @echo ' install TEXMFROOT=<texmf> - install the package into the path <texmf>' + + +NAME = poetrytex +DOC = $(NAME).pdf +DTX = $(NAME).dtx + +# Redefine this to print output if you need: +REDIRECT = > /dev/null + +# Files grouped by generation mode +COMPILED = $(DOC) +UNPACKED = poetrytex.sty +SOURCE = $(DTX) Makefile README.md +GENERATED = $(COMPILED) $(UNPACKED) + +CTAN_FILES = $(SOURCE) $(COMPILED) + +UNPACKED_DOC = + +RUNFILES = $(filter-out $(UNPACKED_DOC), $(UNPACKED)) +DOCFILES = $(COMPILED) README.md $(UNPACKED_DOC) +SRCFILES = $(DTX) Makefile + +ALL_FILES = $(RUNFILES) $(DOCFILES) $(SRCFILES) + +# Installation locations +FORMAT = latex +RUNDIR = $(TEXMFROOT)/tex/$(FORMAT)/$(NAME) +DOCDIR = $(TEXMFROOT)/doc/$(FORMAT)/$(NAME) +SRCDIR = $(TEXMFROOT)/source/$(FORMAT)/$(NAME) +TEXMFROOT = $(shell kpsewhich --var-value TEXMFHOME) + +CTAN_ZIP = $(NAME).zip +TDS_ZIP = $(NAME).tds.zip +ZIPS = $(CTAN_ZIP) $(TDS_ZIP) + +DO_LATEX = pdflatex --interaction=nonstopmode $< $(REDIRECT) +DO_LATEX_WRITE18 = pdflatex --shell-escape --interaction=nonstopmode $< $(REDIRECT) +DO_TEX = tex --interaction=nonstopmode $< $(REDIRECT) +DO_MAKEINDEX = makeindex -s gind.ist $(subst .dtx,,$<) $(REDIRECT) 2>&1 +DO_MAKECHANGES = makeindex -s gglo.ist -o $(NAME).gls $(NAME).glo $< $(REDIRECT) 2>&1 + +all: $(GENERATED) +doc: $(COMPILED) +unpack: $(UNPACKED) +ctan: $(CTAN_ZIP) +tds: $(TDS_ZIP) +world: all ctan + +gendoc: $(DTX) + @echo "Compiling documentation" + $(DO_LATEX_WRITE18) + $(DO_MAKEINDEX) + $(DO_MAKECHANGES) + while ($(DO_LATEX_WRITE18) ; \ + grep -q "Rerun to get cross" $(NAME).log ) do true; \ + done + +$(DOC): $(DTX) + @echo "Compiling documentation" + $(DO_LATEX) + $(DO_MAKEINDEX) + $(DO_MAKECHANGES) + while ($(DO_LATEX) ; \ + grep -q "Rerun to get cross" $(NAME).log ) do true; \ + done + + +$(UNPACKED): $(DTX) + @$(DO_TEX) + +$(CTAN_ZIP): $(CTAN_FILES) $(TDS_ZIP) + @echo "Making $@ for CTAN upload." + @$(RM) -- $@ + @zip -9 $@ $^ >/dev/null + +define run-install +@mkdir -p $(RUNDIR) && cp $(RUNFILES) $(RUNDIR) +@mkdir -p $(DOCDIR) && cp $(DOCFILES) $(DOCDIR) +@mkdir -p $(SRCDIR) && cp $(SRCFILES) $(SRCDIR) +endef + +define run-sty-install +@mkdir -p $(RUNDIR) && cp $(RUNFILES) $(RUNDIR) +endef + +$(TDS_ZIP): TEXMFROOT=./tmp-texmf +$(TDS_ZIP): $(ALL_FILES) + @echo "Making TDS-ready archive $@." + @$(RM) -- $@ + $(run-install) + @cd $(TEXMFROOT) && zip -9 ../$@ -r . >/dev/null + @$(RM) -r -- $(TEXMFROOT) + +# Rename the README for CTAN +README: README.md + cp $< $@ + +.PHONY: install manifest clean mrproper + +install: $(ALL_FILES) + @if test ! -n "$(TEXMFROOT)" ; then \ + echo "Cannot locate your home texmf tree. Specify manually with\n\n make install TEXMFROOT=/path/to/texmf\n" ; \ + false ; \ + fi ; + @echo "Installing in '$(TEXMFROOT)'." + $(run-install) + +sty-install: $(RUNFILES) + @if test ! -n "$(TEXMFROOT)" ; then \ + echo "Cannot locate your home texmf tree. Specify manually with\n\n make install TEXMFROOT=/path/to/texmf\n" ; \ + false ; \ + fi ; + @echo "Installing in '$(TEXMFROOT)'." + $(run-install) + +manifest: + @echo "Source files:" + @for f in $(SOURCE); do echo $$f; done + @echo "" + @echo "Derived files:" + @for f in $(GENERATED); do echo $$f; done + +clean: + @$(RM) -- *.log *.aux *.toc *.idx *.ind *.ilg *.glo *.gls *.example *.out *.synctex* *.tmp poetrytex-style.sty *.ins poetrytex*.pdf poetrytex*.dvi + @$(RM) -- $(GENERATED) $(ZIPS) + @$(RM) -- $(builddir)/* + + +############# +# TESTSUITE # +############# + +#### Needed to compile and make stuff #### + +builddir=build +lprefix=L +xprefix=X +both=F + +COPY = cp -a +MOVE = mv -f +COMPARE_OPTS = -density 300x300 -metric ae -fuzz 35% + +LTXSOURCE = $(NAME).sty diff --git a/Master/texmf-dist/source/latex/poetrytex/poetrytex.dtx b/Master/texmf-dist/source/latex/poetrytex/poetrytex.dtx new file mode 100644 index 00000000000..68b8d4262aa --- /dev/null +++ b/Master/texmf-dist/source/latex/poetrytex/poetrytex.dtx @@ -0,0 +1,831 @@ +% \iffalse +%<*internal> +\begingroup +\input docstrip.tex +\keepsilent +\usedir{tex/latex/poetrytex} +\preamble + + 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. + +\endpreamble +\postamble + + ___________ + Maintainer: Sam Whited + Website: https://samwhited.com + Contact: sam@samwhited.com + Public key: 0xEC2C9934 + + This work consists of this file poetrytex.dtx + and the derived files poetrytex.sty + and poetrytex.pdf + +\endpostamble +\askforoverwritefalse + +\generate{\file{poetrytex.sty}{\from{poetrytex.dtx}{poetrytex}}} +\generate{\file{poetrytex-style.sty}{\from{poetrytex.dtx}{doc-style}}} + +\obeyspaces +\Msg{****************************************************} +\Msg{* *} +\Msg{* To finish the installation you have to move the *} +\Msg{* following file into a directory searched by TeX: *} +\Msg{* *} +\Msg{* poetrytex.sty *} +\Msg{* *} +\Msg{****************************************************} + +\endgroup +%</internal> +% +%<*driver> +\ProvidesFile{poetrytex.dtx} +%</driver> +%<poetrytex>\ProvidesPackage{poetrytex} +% +%<*driver> +\documentclass[a4paper]{ltxdoc} +\usepackage{poetrytex-style} +\usepackage{poetrytex} +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\begin{document} + \DocInput{\jobname.dtx} +\end{document} +%</driver> +% +% \fi +% +% \GetFileInfo{poetrytex.dtx} +% \makeatletter +% \errorcontextlines=999 +% +% \title{The \textsf{poetrytex} package} +% \author{ +% \name{Sam Whited}\\ +% \texttt{sam@samwhited.com} +% } +% \date{\today\\v1.0\githead\gitdirty\gituncommitted} +% +% \maketitle +% \maketoc +% +% \section{Introduction} +% +% The \pkg{poetrytex} package is designed to aid in the formatting and +% typesetting of anthologies of poetry. +% +% \subsection{History} +% +% The package started out as a collection of macros for automating simple tasks +% that I often had to perform while working on a collection of poetry and prose. +% After a time, I decided to turn it into an STY file which would be geared +% more towards the idea of an anthology or a collection of works and less about +% typesetting the verse itself (for which there were already several good +% packages on CTAN). While the file was small this worked well---Learning to +% use the package was easily accomplished by reading the annotated source code +% (generated via a modified version of Jeremy Ashkenas' literate programming +% tool `docco'). However, as the source and scope of the project grew I decided +% to move away from docco and start working on a proper package that would use +% more traditional \TeX-style docs. +% +% \subsection{License / about the source} +% +% This project 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 opinion) any later version. The latest version of this license is in: +% +% \url{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. +% +% Contributions are welcome, and the latest development version of the project +% can always be found at \url{https://github.com/samwhited/poetrytex}. +% +% \subsection{Acknowledgements} +% +% A special thanks is in order for Brittany Taylor. Though she probably has no +% idea what \TeX\ is or that this project even exists it is due mostly to her +% influence that it ever got off the ground. +% +% \StopEventually{} +% \changes{1.0}{2012/07/18}{Converted package to dtx} +% +% \section{Package building and loading} +% +% \begin{macrocode} +%<*poetrytex> +% \end{macrocode} +% +% \paragraph{Building} +% +% Before building \pkg{poetrytex} you should verify that the following +% dependencies are installed: +% \changes{1.0}{2012/07/18}{Removed fontspec / xelatex dependency} +% \begin{macrocode} +\RequirePackage{expl3} +\RequirePackage[pdfborder=0, bookmarks, colorlinks=false, hidelinks]{hyperref} +\RequirePackage[parfill]{parskip} +% \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 +% \code{make help} will tell you everything you need to know. To manually +% extract the files and generate the documentation simply run \code{pdflatex} +% or \XeLaTeX\ against \fname{poetrytex.dtx}: +% +% \begin{Verbatim} +% pdflatex poetrytex.dtx +% \end{Verbatim} +% +% You can also use the \code{-{}-shell-escape} option to generate documentation +% which includes the current git commit short-hash in the version number: +% +% \begin{Verbatim} +% xelatex --shell-escape poetrytex.dtx +% \end{Verbatim} +% +% 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: +% +% \begin{Verbatim} +% \usepackage{poetrytex} +% \end{Verbatim} +% +% +% \part{Document setup and structure} +% +% The \pkg{poetrytex} package is fairly simple as far as \TeX\ packages go, so +% it's worth taking a look at how it works internally. +% +% \section{Environment setup and defaults} +% +% First we setup our environment, define some useful properties, and choose some +% default values for those properties. +% +% \subsection{Title page} +% +% We'll start with the title page: +% +% \begin{macrocode} +\newcommand*{\pttitle}{Title} +\newcommand*{\ptsubtitle}{Subtitle} +\newcommand*{\ptauthor}{Author} +\newcommand*{\ptdate}{\today} +% \end{macrocode} +% +% Since we define the properties above as commands, you can change the +% appearance of your document by redefining them in your preamble like so: +% +% \begin{Verbatim} +% \renewcommand*{\pttitle}{My Title} +% \renewcommand*{\ptauthor}{The Author} +% \end{Verbatim} +% +% We then use these properties to set the document title, author, and date: +% \begin{macrocode} +\title{% + \pttitle% + \ifx\ptsubtitle\@ptundefined\relax\else\\\ptsubtitle\fi% +} +\author{\ptauthor} +\date{\ptdate} +% \end{macrocode} +% Since \code{\textbackslash maketitle} clears the internal title, author, and +% 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. +% \begin{macrocode} +\newcommand*{\@ptpoemlabeltext}{poetrytexpoem:} +% \end{macrocode} +% 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 +% with \code{\textbackslash @ptpoemlabeltext} to prevent it from conflicting +% with user defined labels, or labels defined in other packages. +% +% Chances are you'll never need to touch this. +% +% \begin{macrocode} +\newcounter{poemnum} +\newcounter{absolutepoemnum} +% \end{macrocode} +% The \code{poemnum} and \code{absolutepoemnum} counters will be incremented +% every time we include a poem in our document and can be used later to number +% the poems. +% +% \subsection{Dedication} +% +% After your title page you might want to add a dedication page. +% +% \begin{macro}{\makededication} +% As with the \code{\textbackslash pttitle} and author commands you can simply +% redefine \code{\textbackslash ptdedication} to change the dedication text. +% \begin{macrocode} +\newcommand*{\ptdedication}{} +\newcommand*{\makededication}[0]{% + \thispagestyle{empty} + \vspace*{\fill} + \begin{flushright} + \emph{\ptdedication} + \end{flushright} + \vspace*{\fill} +} +% \end{macrocode} +% \end{macro} +% +% \subsection{Tables and links} +% +% Next we setup the table of contents and list of poems: +% \begin{macrocode} +\setcounter{secnumdepth}{-1} +\setcounter{tocdepth}{2} +\newcommand*{\toptitle}{List of Poems} +\renewcommand*{\listtablename}{\toptitle} +\newcommand*{\topentrytype}{subsection} +% \end{macrocode} +% +% First, we set the \code{secnumdepth} and \code{tocdepth} counters to disable +% chapter, section, and subsection numbering, and to limit the maximum depth of +% entries in the TOC. We then choose a default value for \code{\textbackslash% +% toptitle} which will be rendered atop the Table of Poems, and set the default +% entry type for poems to `subsection.' As with the previous options, these can +% all be redefined to suit your needs. +% +% \begin{macro}{\maketoc} +% \begin{macro}{\maketop} +% \begin{macro}{\maketop*} +% Once you've configured the TOC and TOP you probably want to insert them into +% your document somewhere. While you could just use the \LaTeX\ commands \code{% +% \textbackslash tableofcontents} and \code{\textbackslash listoftables}, we +% provide alternatives that add a bit of formatting and clear the page. By +% default the TOP creates a listing in the TOC---Using the star modifier +% prevents this. +% \begin{macrocode} +\newcommand*{\maketoc}{% + \tableofcontents + \pagestyle{plain} + \clearpage + \thispagestyle{empty} +} +\newcommand*{\maketop}{\@ifstar{\@ptmaketopStar}{\@ptmaketopNoStar}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macrocode} +\newcommand*{\@ptmaketopStar}{% + \listoftables + \pagestyle{plain} + \clearpage +} +\newcommand*{\@ptmaketopNoStar}{% + \cleardoublepage + \phantomsection + \addcontentsline{toc}{section}{\toptitle} + \listoftables + \pagestyle{plain} + \clearpage +} +% \end{macrocode} +% \begin{macro}{\numbertop} +% Placing this command in your document preamble will cause the table of poems +% to be numbered. +% \begin{macrocode} +\newcommand*{\numbertop}{\newcommand*{\@ptnumbertop}{}} +% \end{macrocode} +% \end{macro} +% +% \part{Poems and annotations} +% +% Now that we've got all the boilerplate, configuration, titles, tables, and +% properties out of the way, it's time to move on to the core functionality of +% \pkg{poetrytex}: displaying and organizing poems! +% +% \section{The \code{poem} environment} +% +% 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]{% +% \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}). +% +% \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] +% {The Sea Bell}{J.R.R. Tolkien} +% I walked by the sea, +% and there came to me,\\ +% as a star-beam on the wet sand,\\ +% a white shell like a sea-bell;\\ +% trembling it lay +% in my wet hand.\\ +% In my fingers shaken +% I heard waken\\ +% a ding within, by a harbour bar\\ +% a buoy swinging, a call ringing\\ +% over endless seas, +% faint now and far\ldots +% \end{poem} +% \end{Verbatim} +% \columnbreak +% \begin{poem}[center] +% {The Sea Bell} +% {J.R.R. Tolkien} +% I walked by the sea, +% and there came to me,\\ +% as a star-beam on the wet sand,\\ +% a white shell like a sea-bell;\\ +% trembling it lay in my wet hand.\\ +% In my fingers shaken I heard waken\\ +% a ding within, by a harbour bar\\ +% a buoy swinging, a call ringing\\ +% over endless seas, +% faint now and far\ldots +% \end{poem} +% \end{Example} +% +% Now we render the page header, title, and the actual poem: +% \begin{macrocode} + \poetryheadings + \addtocounter{poemnum}{1} + \addtocounter{absolutepoemnum}{1} + \begin{center} + \phantomsection% + \addcontentsline{lot}{\topentrytype}{% + \ifx\@ptnumbertop\@ptundefined% + \relax% + \else% + \arabic{poemnum}.\ % + \fi#2}% + \label{\@ptpoemlabeltext\arabic{absolutepoemnum}} + {\poemtitleformat% + \ifx\@ptnumberpoems\@ptundefined + \relax + \else + \arabic{poemnum}\\% + \fi#2}\\% + #3 + \end{center} + \begin{\@ptwrapenvironment} + \begingroup\setlength{\parskip}{\stanzaparskip} +}{% + \endgroup + \end{\@ptwrapenvironment} + \ifx\@ptclearpageafterpoem\@ptundefined + \relax + \else + \clearpage + \fi +} +% \end{macrocode} +% +% \section{Formatting} +% +% The \code{poem} environment provides some reasonable defaults for formatting +% your work but chances are you want a little more control. +% +% \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, +% you can change how your headings look, use packages like \pkg{fancyhdr}, or +% remove headers from poem pages altogether. +% \begin{macrocode} +\newcommand*{\poetryheadings}[0]{% + \pagestyle{myheadings} + \markboth{ | \MakeUppercase{\pttitle}\hfill } + {\hfill\MakeUppercase{\ptgroup}\ | } +} +% \end{macrocode} +% \end{macro} +% +% \subsection{Numbering} +% +% \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. +% \begin{macrocode} +\newcommand*{\resetnumongroup}{\newcommand*{\@ptresetnumongroup}{}} +\newcommand*{\numberpoems}{\newcommand*{\@ptnumberpoems}{}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% Using \code{\textbackslash numberpoems} results in: +% \clearpage +% \begin{Example} +% \begin{Verbatim} +% \numberpoems +% +% \begin{poem}{The Highwayman} +% {Alfred Noyes} +% The wind was a torrent of +% darkness among the gusty trees,\\ +% The moon was a ghostly galleon +% tossed upon cloudy seas,\\ +% The road was a ribbon of +% moonlight over the purple moor +% \end{poem} +% \end{Verbatim} +% \columnbreak +% \numberpoems +% +% \begin{poem}{The Highwayman}{Alfred Noyes} +% The wind was a torrent of +% darkness among the gusty trees,\\ +% The moon was a ghostly galleon +% tossed upon cloudy seas,\\ +% The road was a ribbon of +% moonlight over the purple moor +% \end{poem} +% \end{Example} +% +% \subsection{Spacing and indentation} +% +% The \code{stanzaparskip} length is used to change the \code{parskip} within a +% poem environment. +% \begin{macrocode} +\newlength{\stanzaparskip} +\setlength{\stanzaparskip}{0.7em} +% \end{macrocode} +% +% \begin{macro}{\clearpageafterpoem} +% This macro causes the page to be cleared after every poem environment. +% \begin{macrocode} +\newcommand*{\clearpageafterpoem}{\newcommand*{\@ptclearpageafterpoem}{}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ptind} +% \begin{macro}{\ptind*} +% The \code{\textbackslash ptgap} macro 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 +% 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% +% ptind} indents by. The starred version of \code{ptind} uses\code{% +% \textbackslash hspace*}. +% \begin{macrocode} +\newlength{\ptgap} +\setlength{\ptgap}{2em} +\newcommand*{\ptind}{% + \@ifstar{% + \@ptindStar + }{% + \@ptindNoStar + } +} +\newcommand*{\@ptindStar}{\hspace*{\ptgap}} +\newcommand*{\@ptindNoStar}{\hspace{\ptgap}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% Using it works something like this: +% \clearpage +% \begin{Example} +% \begin{Verbatim} +% \setlength{\ptgap}{2em} +% \begin{poem}[flushleft]{PoE\TeX} +% {An {\tipaencoding +% /Ig"zA:mp@l/} poem} +% There once was a poem called% +% PoE\TeX\\* +% That's name sounded somewhat% +% {\tipaencoding /p@"TEtEk/}.\\* +% \ptind It was really quite% +% sad,\\* +% \ptind to see pronunciation% +% so bad,\\* +% And to read such a terrible% +% {\tipaencoding /"lIme(@)rEk/}! +% \end{poem} +% \end{Verbatim} +% \columnbreak +% \setlength{\ptgap}{2em} +% \begin{poem}[flushleft]{PoE\TeX} +% {An {\tipaencoding +% /Ig"zA:mp@l/} poem} +% There once was a poem called% +% PoE\TeX\\* +% That's name sounded somewhat% +% {\tipaencoding /p@"TEtEk/}.\\* +% \ptind It was really quite% +% sad,\\* +% \ptind to see pronunciation% +% so bad,\\* +% And to read such a terrible% +% {\tipaencoding /"lIme(@)rEk/}! +% \end{poem} +% \end{Example} +% +% \subsection{Stylization} +% +% By redefining \code{\textbackslash poemtitleformat} we can change how the poem +% title is rendered. +% \begin{macrocode} +\newcommand*{\poemtitleformat}{\normalfont\bfseries\large\centering} +% \end{macrocode} +% +% +% If you want a stylistic marker between two poems, or between sections +% or stanzas within a poem, the following commands are your friend. +% +% The \code{ptspacergap} length is the indentation of the spacer, and\code{% +% \textbackslash ptspacerchar} is the actual character that will be printed +% \code{\textbackslash ptspacernum} times. +% \begin{macrocode} +\newlength{\ptspacergap} +\setlength{\ptspacergap}{4em} +\newcommand*{\ptspacerchar}{\S} +\newcommand*{\ptspacernum}{3} +% \end{macrocode} +% +% \begin{macro}{\ptspacer} +% \changes{1.0}{2012/07/17}{Repeat \code{\textbackslash ptspacernum} times} +% \begin{macro}{\ptspacer*} +% The starred version of the \code{ptspacer} command uses \code{\textbackslash% +% hspace*} for indention. +% \begin{macrocode} +\newcommand*{\ptspacer}{% + \@ifstar{% + \@ptspacerStar + }{% + \@ptspacerNoStar + } +} +\newcommand*{\@ptspacerStar}{% + \hspace*{\ptspacergap}% + \@ptrepeat{\ptspacernum}{\ptspacerchar}% +} +\newcommand*{\@ptspacerNoStar}{% + \hspace{\ptspacergap}% + \@ptrepeat{\ptspacernum}{\ptspacerchar}% +} +\ExplSyntaxOn +\cs_new_eq:NN \@ptrepeat \prg_replicate:nn +\ExplSyntaxOff +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% For example: +% \begin{Example} +% \begin{Verbatim} +% \renewcommand{\ptspacerchar}{\o} +% \renewcommand{\ptspacernum}{2} +% \begin{poem}{The Love Song% +% of J. Alfred Prufrock} +% {T.S. Eliot} +% \ldots I should have been a pair% +% of ragged claws\\ +% Scuttling across the floors of% +% silent seas. +% +% \ptspacer +% +% And the afternoon, the evening, +% sleeps so peacefully!\\ +% Smoothed by long fingers,\\ +% Asleep\ldots\ tired\ldots\ or% +% it malingers,\\ +% Stretched on the floor, here% +% beside you and me\ldots +% \end{poem} +% \end{Verbatim} +% \columnbreak +% \renewcommand{\ptspacerchar}{\o} +% \renewcommand{\ptspacernum}{2} +% \begin{poem}{The Love Song% +% of J. Alfred Prufrock} +% {T.S. Eliot} +% \ldots I should have been a pair% +% of ragged claws\\ +% Scuttling across the floors of% +% silent seas. +% +% \ptspacer +% +% And the afternoon, the evening, +% sleeps so peacefully!\\ +% Smoothed by long fingers,\\ +% Asleep\ldots\ tired\ldots\ or% +% it malingers,\\ +% Stretched on the floor, here% +% beside you and me\ldots +% \end{poem} +% \end{Example} +% +% \subsection{Groups and linking} +% +% When putting together a large collection of poetry and prose you most likely +% need a way to organize your works and find them quickly. While the table of +% poems helps we might also want to link directly to poems, or further subdivide +% the collection into groups of related works (by year written, or subject +% matter for instance). +% +% \begin{macro}{\linktopoem} +% We can link to poems easily enough by providing \code{linktopoem} with the +% number of the poem and the text for the link. If only one argument is given +% it is used as both the link destination and text. +% \begin{macrocode} +\newcommand*{\linktopoem}[2][false]{% + \newcommand*{\@ptfirstarg}{#1} + \newcommand*{\@ptfalse}{false} + \ifx \@ptfirstarg \@ptfalse + \hyperref[\@ptpoemlabeltext#2]{#2}\relax + \else + \hyperref[\@ptpoemlabeltext#1]{#2}\relax + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\poemgroup} +% \begin{macro}{\poemgroup*} +% Dividing poems up into groups can be accomplished with the \code{poemgroup} +% command. The command creates a title-page for the group at the current +% location and adds entries to the TOP and TOC unless the starred version of the +% command is used. The \code{\textbackslash ptgroup} command will always contain +% a reference to the current group in case you need to refer to it later. +% \begin{macrocode} +\newcommand*{\ptgroup}{} +\newcommand*{\poemgroup}{% + \@ifstar{% + \@ptpoemgroupStar + }{% + \@ptpoemgroupNoStar + } +} +\newcommand*{\@ptpoemgroupStar}[1]{% + \ifx\@ptresetnumongroup\@ptundefined + \relax + \else + \setcounter{poemnum}{0} + \fi + \cleardoublepage + \vspace*{\fill} + \renewcommand*{\ptgroup}{#1} + \pagestyle{empty} + \begin{center} + \section*{#1} + \end{center} + \vspace*{\fill} + \clearpage +} +\newcommand*{\@ptpoemgroupNoStar}[1]{% + \ifx\@ptresetnumongroup\@ptundefined + \relax + \else + \setcounter{poemnum}{0} + \fi + \cleardoublepage + \vspace*{\fill} + \renewcommand*{\ptgroup}{#1} + \pagestyle{empty} + \begin{center} + \section{#1} + \addcontentsline{lot}{section}{#1} + \end{center} + \vspace*{\fill} + \clearpage +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \section{The \code{annotation} environment} +% +% Annotations allow you to insert text into your document that maintains some +% of the page formatting of the \code{poem} environment without the text itself +% actually being formatted like verse. It uses \code{\textbackslash% +% poetryheadings}, clears the page twice, and adds itself to the TOC (but not +% the TOP). The page is also cleared again after the annotation. +% +% \begin{macrocode} +\newenvironment{annotation}[1]{% + \cleardoublepage + \poetryheadings + \begin{flushleft} + \subsection{#1} +}{% + + \end{flushleft} + \clearpage +} +% \end{macrocode} +% +% \begin{macrocode} +%</poetrytex> +% \end{macrocode} +% +% \clearpage +% \setcounter{IndexColumns}{2} +% \PrintIndex +% +% \makeatletter +% \renewenvironment{theglossary}{% +% \glossary@prologue +% \setlength\emergencystretch{5em} +% \GlossaryParms \let\item\@idxitem \ignorespaces}{} +% \makeatother +% \clearpage +% \PrintChanges +% +% \Finale +% +% \iffalse +%<*doc-style> +% \begin{macrocode} +\ProvidesPackage{poetrytex-style} + +\usepackage{fancyvrb,hologo,multicol,tipa,url} + +\fvset{gobble=2} + +\newenvironment{Example}{% + \begingroup\setlength{\columnseprule}{.4pt} + \begin{multicols}{2} +}{ + \end{multicols} + \endgroup +} + +\newcommand*{\githead}{% + \immediate\write18{% + rm githead.tex 2> /dev/null; git rev-parse --short HEAD > githead.tex + }% + \InputIfFileExists{githead.tex}{.}{}\unskip% + \immediate\write18{% + rm githead.tex 2> /dev/null + }% +} + +\newcommand*{\gitdirty}{% + \immediate\write18{% + rm gitdirty.tex 2> /dev/null; git diff-files --quiet || echo "*" > gitdirty.tex + }% + \InputIfFileExists{gitdirty.tex}{\endlinechar=-1\relax}{}\unskip% + \immediate\write18{% + rm gitdirty.tex 2> /dev/null + }% +} + +\newcommand*{\gituncommitted}{% + \immediate\write18{% + rm gituncommitted.tex 2> /dev/null; git diff-index --quiet --cached HEAD || echo "+" > gituncommitted.tex + }% + \InputIfFileExists{gituncommitted.tex}{\endlinechar=-1\relax}{}\unskip% + \immediate\write18{% + rm gituncommitted.tex 2> /dev/null + }% +} + +\newcommand\XeTeX{\hologo{XeTeX}} +\newcommand\XeLaTeX{\hologo{XeLaTeX}} +\newcommand\LuaTeX{\hologo{LuaTeX}} +\newcommand\LuaLaTeX{\hologo{LuaLaTeX}} + +\newcommand*\name[1]{\textsc{#1}} +\newcommand*\fname[1]{\textsf{#1}} +\newcommand*\pkg[1]{\textsf{#1}} +\newcommand*\code[1]{\texttt{#1}} + +\renewcommand\partname{Part} +% \end{macrocode} +%</doc-style> +%\fi +\endinput |