blob: 527e696423c6cf9929d0a3a863eec13f1e4adba5 (
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
%%
%% This is file `contracard.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% contracard.dtx (with options: `contracard-pkg')
%%
%% 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.
%%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{contracard}[2013/02/20]
\RequirePackage{intcalc}
\RequirePackage{ifthen}
\newcommand*{\defaultcontraenv}{flushleft}
\newcommand*{\dancetitleenv}{flushleft}
\newcommand*{\dancetitleformat}{\section*}
\newcommand*{\danceauthorformat}{\subsection*}
\newcommand*{\danceformformat}{\hfill}
\newcommand*{\movedelimiter}{,}
\newcommand*{\partdelimiter}{.}
\newcommand*{\midpartdelimiter}{;}
\newcounter{dancecount}
\newcounter{partcount}
\newcounter{phrasecount}
\newcounter{dancepart}
\newcounter{dancephrase}
\newcommand*{\resetdancephrase}{%
\ifthenelse{\value{partcount}=16}{\newline}{}%
\@ifstar{\@resetdancephraseStar}{\@resetdancephraseNoStar}%
}
\newcommand*{\@resetdancephraseStar}{%
\setcounter{dancephrase}{1}%
\setcounter{phrasecount}{0}%
\resetdancepart*
}
\newcommand*{\@resetdancephraseNoStar}{%
\ifthenelse{\value{dancephrase}=1}{}{%
\setcounter{dancephrase}{1}%
\setcounter{phrasecount}{0}%
\resetdancepart
}%
}
\newcommand*{\resetdancepart}{%
\@ifstar{\@resetdancepartStar}{\@resetdancepartNoStar}%
}
\newcommand*{\@resetdancepartStar}{%
\setcounter{dancepart}{1}%
\setcounter{partcount}{0}%
}
\newcommand*{\@resetdancepartNoStar}{%
\ifthenelse{\value{dancepart}=1}{}{%
\setcounter{dancepart}{1}%
\setcounter{partcount}{0}%
}%
}
\newcommand*{\newdancephrase}{%
\ifthenelse{\not\value{phrasecount}=0\and\not\value{phrasecount}=32}{\newline}{}%
\addtocounter{dancephrase}{1}%
\setcounter{phrasecount}{0}%
\resetdancepart*
}
\newcommand*{\newdancepart}{%
\addtocounter{dancepart}{1}%
\setcounter{partcount}{0}%
}
\newenvironment{contra}[4][\defaultcontraenv]{%
\setcounter{dancecount}{0}
\resetdancepart*
\resetdancephrase*
\ifdefined\@ccisclass\clearpage\fi%
\begin{\dancetitleenv}
\ifdefined\@ccisclass%
\pagestyle{myheadings}
\thispagestyle{myheadings}
\markboth{}{\danceformformat{#4}}
\else%
{\danceformformat{#4}}%
\fi%
{\dancetitleformat{#2}}%
{\danceauthorformat{#3}}%
\end{\dancetitleenv}
\newcommand*{\@contraenv}{#1}
\begin{\@contraenv}
}{%
\end{\@contraenv}
}
\newcommand*{\move}[2][16]{%
\ifthenelse{\value{partcount}=16}{\newline}{}%
\ifthenelse{\value{phrasecount}=32}{%
\newdancephrase%
}{%
\ifthenelse{\value{partcount}=16}{%
\newdancepart%
}{}%
}
\ifthenelse{\intcalcMod{\value{dancecount}}{16}=0}{%
\Alph{dancephrase}\arabic{dancepart}\partdelimiter\ %
}{}%
\addtocounter{dancecount}{#1}%
\addtocounter{phrasecount}{#1}%
\addtocounter{partcount}{#1}%
#2%
\ifthenelse{\value{phrasecount}=32}{%
\pagebreak[1]\vspace{1em}%
}{}%
\ifthenelse{\value{partcount}=8}{\midpartdelimiter\nopagebreak}{%
\ifthenelse{\not\value{partcount}=16}{\movedelimiter\nopagebreak\nolinebreak[2]}{}}%
}
%%
%% ___________
%% Maintainer: Sam Whited
%% Website: https://samwhited.com
%% Contact: sam@samwhited.com
%% Public key: 0xEC2C9934
%%
%% This work consists of this file contracard.dtx
%% and the derived files contracard.sty
%% and contracard.cls
%% and contracard.pdf
%%
%%
%% End of file `contracard.sty'.
|