summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/shipunov/tex/altverse.sty
blob: a0cbbf53487d38a1856658af125af427d0e608a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
% Author: Alexey Shipunov, dactylorhiza@gmail.com

\ProvidesPackage{altverse}
	[2008/02/15 v0.3 Typesetting simple verses with `xtab' package]

\RequirePackage{array}
\RequirePackage{xtab}

% Typical environment, stanzas and subverses separated by `\\'
\newenvironment{Verse}[1][\relax]%
        {\tablehead{}%
        \tablefirsthead{}%
        \tabletail{}%
        \tablelasttail{}%
        \begin{center}%
        \global\def\V@TMP{#1}%
        \let\_\Vindent
                \begin{xtabular}{@{}>{\V@TMP}l@{}}}%
                {\end{xtabular}%
        \end{center}}

% Same, ragged left
\newenvironment{VERSE}[1][\relax]%
        {\tablehead{}%
        \tablefirsthead{}%
        \tabletail{}%
        \tablelasttail{}%
        \global\def\V@TMP{#1}%
        \let\_\Vindent
                \begin{xtabular}{@{}>{\V@TMP}l@{}}}%
                {\end{xtabular}}

% Same, with footnotes
\newenvironment{Verse*}[1][\relax]%
        {\tablehead{}%
        \tablefirsthead{}%
        \tabletail{}%
        \tablelasttail{}%
        \begin{center}%
        \global\def\V@TMP{#1}%
        \let\_\Vindent
        \renewcommand{\thempfootnote}{\fnsymbol{mpfootnote}}%
                \begin{mpxtabular}{@{}>{\V@TMP}l@{}}}%
                {\end{mpxtabular}%
        \end{center}}

% If you need to manually break one of these environments:
% Example: `\Vbreak{VERSE}'
\newcommand*{\Vbreak}[1]{\end{#1}\newpage\begin{#1}}

% For indents, abbreviations inside environments `\_'
% One may set indent for whole verse: \begin{Verse}[\Vindent{2}]
\newcommand*{\Vindent}[1][.5]{\hspace*{#1in}}

% Header CONTENTS, needs to be set BEFORE the environment
\newcommand*{\Vhead}[2][\Vhead@TMP]{\def\Vhead@TMP{#2}\V@TOC{#1}\V@MARK{#1}}
% Put information to the table of contents and headers
\newcommand*{\V@TOC}[1]{\markright{#1}}
\newcommand*{\V@MARK}[1]{\addcontentsline{toc}{subsection}{#1}}

% Actual header, centered, should be without `\\'
\newcommand{\VCtitle}{%
        \multicolumn{1}{@{}>{\V@TMP\centering\hspace{0pt}}p{\VheadSize}@{}}%
        {\VheadFormat\Vhead@TMP\par}\\*}
% Alternate header, with less space after
\newcommand{\Vctitle}{%
        \multicolumn{1}{@{}>{\V@TMP\centering\hspace{0pt}}p{\VheadSize}@{}}%
        {\VheadFormat\Vhead@TMP}\\*}
% Alternate header, ragged left, should be without `\\'
\newcommand{\VLtitle}{%
        \multicolumn{1}{@{}>{\V@TMP\raggedright\hspace{0pt}}p{\VheadSize}@{}}%
        {\VheadFormat\Vhead@TMP\par}\\*}
% Heading stars before verse
\newcommand{\Vstars}{\multicolumn{1}{@{}>{\V@TMP}c@{}}%
        {${*}\quad{*}\quad{*}$}\\*[\bigskipamount]}

% Subheader, should be without `\\'
\newcommand{\Vsub}[1]{%
        \multicolumn{1}{@{}>{\centering\hspace{0pt}}p{\VheadSize}@{}}%
        {#1}\\*}

% Dedication, should be _with_ `\\'
\newcommand*{\Vto}[1]{\multicolumn{1}{@{}>{\V@TMP}r@{}}%
        {\VtoFormat#1}}

% Annotation
\newcommand*{\Vat}[1]{\V@TMP\VatFormat#1}

% Hooks for redefinitions
\newcommand*{\VheadFormat}{\reset@font\large\bfseries}
\newcommand*{\VheadSize}{.4\columnwidth}
\newcommand*{\VtoFormat}{\reset@font\itshape}
\newcommand*{\VatFormat}{\reset@font\itshape}

\endinput