summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/contracard/contracard.sty
blob: ede9fe22a3592eb5656001496c91bec357df755d (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
134
135
136
137
138
139
140
141
142
143
144
145
146
%%
%% 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}
\RequirePackage{tocloft}
\newcommand*{\defaultcontraenv}{flushleft}
\newcommand*{\dancetitleenv}{flushleft}
\newcommand*{\dancetitleformat}{\section*}
\newcommand*{\danceauthorformat}{\subsection*}
\newcommand*{\danceformformat}{\hfill}
\newcommand*{\movedelimiter}{,}
\newcommand*{\partdelimiter}{.}
\newcommand*{\midpartdelimiter}{;}
\newlength{\phrasevspace}
\setlength{\phrasevspace}{1em}
\newcommand*{\phraseseparator}{\vspace{\phrasevspace}}
\newcounter{dancecount}
\newcounter{partcount}
\newcounter{phrasecount}
\newcounter{dancepart}
\newcounter{dancephrase}
\newcounter{dancepartlength}
\setcounter{dancepartlength}{16}
\newcounter{dancephraselength}
\setcounter{dancephraselength}{32}
\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}{\newline}{}%
  \addtocounter{dancephrase}{1}%
  \setcounter{phrasecount}{0}%
  \resetdancepart*
}
\newcommand*{\newdancepart}{%
  \newline
  \addtocounter{dancepart}{1}%
  \setcounter{partcount}{0}%
}
\newenvironment{contra}[4][\defaultcontraenv]{%
  \refstepcounter{dance}
  \addcontentsline{lod}{dance}{\protect\numberline{\thedance}#2}
  \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{phrasecount}=\value{dancephraselength}}{%
    \newdancephrase%
  }{%
    \ifthenelse{\value{partcount}=\value{dancepartlength}}{%
     \newdancepart%
    }{}%
  }
  \ifthenelse{\intcalcMod{\value{dancecount}}{\value{dancepartlength}}=0}{%
    \Alph{dancephrase}\arabic{dancepart}\partdelimiter\ %
  }{}%
  \addtocounter{dancecount}{#1}%
  \addtocounter{phrasecount}{#1}%
  \addtocounter{partcount}{#1}%
  #2%
  \ifthenelse{\value{phrasecount}=\value{dancephraselength}}{%
    \pagebreak[1]\phraseseparator%
  }{}%
  \ifthenelse{\value{partcount}=\intcalcDiv{\value{dancepartlength}}{2}}{\midpartdelimiter\nopagebreak}{%
    \ifthenelse{\not\value{partcount}=\value{dancepartlength}}{\movedelimiter\nopagebreak\nolinebreak[2]}{}}%
}
\newlistof{dance}{lod}{\lodtitle}
\newcommand*{\listofdances}{\listofdance}
\newcommand*{\lodtitle}{List of Dances}
%% 
%%   ___________
%%   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'.