summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/contracard/contracard.dtx
blob: fc501c72da0ceb55e4e4fbea6dd06f98be4da81a (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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
% \iffalse
%
%<*driver>
\ProvidesFile{contracard.dtx}
%</driver>
%
%<*contracard-pkg>
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{contracard}[2019/03/03 Package for typesetting called dances]
%</contracard-pkg>
%<*contracard-cls>
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{contracard}[2019/03/03 Class for creating dance calling cards]
\AtEndOfClass{\LoadClass{article}}
%</contracard-cls>
%
%<*driver>
\documentclass[a4paper]{ltxdoc}
\usepackage{ifxetex,ifluatex}
\usepackage{fancyvrb,hologo,framed,multicol,url,graphicx,cclicenses,pifont}
\usepackage[enableidx]{contracard}
\ifxetex
  \usepackage{unicode-math}
\else
  \ifluatex
    \usepackage{unicode-math}
  \else
    \usepackage[utf8x]{inputenc}
  \fi
\fi
\usepackage[pdfborder=0, bookmarks, colorlinks=false, hidelinks]{hyperref}
\usepackage[parfill]{parskip}
\usepackage{bookmark}
\usepackage[page,toc]{appendix}

\fvset{gobble=2}

\newenvironment*{exampledance}{%
  \vspace{3em}
  \begin{framed}
    \begin{minipage}[t][76.2mm][t]{\textwidth}
}{%
    \end{minipage}
  \end{framed}
}

\newcommand*{\gittag}{%
  \immediate\write18{%
    rm gittag.tex 2> /dev/null; (git describe --tags --dirty || echo "v0.0") 2> /dev/null > gittag.tex
  }%
  \InputIfFileExists{gittag.tex}{}{}\unskip%
  \immediate\write18{%
    rm gittag.tex 2> /dev/null
  }%
}

\newcommand*\name[1]{\textsc{#1}}
\newcommand*\fname[1]{\textsf{#1}}
\newcommand*\pkg[1]{\textsf{#1}}
\newcommand*\code[1]{\texttt{#1}}
\newcommand*\regexp[1]{\texttt{#1}}
\newcommand*\word[1]{\textit{#1}}
\newcommand*{\XeLaTeX}{\hologo{XeLaTeX}}
\newcommand*{\LuaLaTeX}{\hologo{LuaLaTeX}}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
  \DocInput{\jobname.dtx}
\end{document}
%</driver>
%
% \fi
%
% \GetFileInfo{contracard.dtx}
% \makeatletter
% \errorcontextlines=999
%
% \title{The Contra Card Project}
% \author{
%   \name{Sam Whited}\\*
%   \texttt{sam@samwhited.com}
% }
% \date{\today\\*\gittag}
%
% \maketitle
% \begin{exampledance}
% \begin{contra}{Monarch Grove}{Martha Wild}{Duple becket}
%   \move{Slide left and circle left \textthreequarters\moveindex{Circle Left}\moveindex{Slide Left}}
%   \swing*[Neighbor]{8}
%   \longlines
%   \dosido*[Men]{8}
%   \allemande*[Men]{8}{left 1\textonehalf}
%   \move{Partner star promenade and butterfly whirl\moveindex{Star Promenade}\moveindex{Butterfly Whirl}}
%   \dosido*[Women]{8}
%   \swing[partner]{8}
% \end{contra}
% \end{exampledance}
% \tableofcontents
% \phantomsection
% \addcontentsline{toc}{section}{\lodtitle}
% \hypertarget{CC:LOD}{}
% \listofdances
%
% \section{Introduction}
%
% The \textbf{Contra Card} project is designed to aid in the formatting and
% typesetting of caller cards for traditional square and line dances.
%
% The project comprises a \LaTeX\ package (\fname{contracard.sty}) and a
% \LaTeX\ class (\fname{contracard.cls}). The package provides the core
% functionality of Contra Card while the class file acts as a convenience
% wrapper for making calling cards.
%
% \subsection{About the source}
%
% Contributions are welcome, and the latest development version of the project
% can always be found at \url{https://git.sr.ht/~samwhited/contracard}.
%
% \subsection{License}
%
% 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.
%
% \subsection{Special thanks}
%
% \renewcommand{\thefootnote}{\fnsymbol{footnote}}%
% \addtocounter{footnote}{1}%
% Several people deserve a special thanks for their contributions to this
% package. Most notably the various callers and dancers who responded to my
% queries on the \href{http://www.sharedweight.net/}{Shared Weight},
% \href{http://groups.yahoo.com/neo/groups/trad-dance-callers/info}{Traditional
% Dance Callers}, and \href{http://www.contradance.org/}{Chatahoochee Country
% Dancers}, mailing lists. These comprise Andrea Nettleton, Bill Baritompa, Seth
% Tepfer, Richard Hopkins, Chris Page, James Saxe, Mark Goodwin, Rob Harper,
% Eric Black, Kalia Kliban, John Sweeney, Martha Wild\footnote{Dances by Martha
% Wild used in this publication are reproduced from \textit{Calls of the Wild}
% by special arrangement with the author.}, and Linda Leslie (in no particular
% order). Also to Sarah Snyder, and all of my other favorite dance partners from
% the Atlanta dance community.
%
% \begin{exampledance}
% \begin{contra}{Lament To Sarah}{Sam Whited}{Duple improper}
%   \lines*[In your set, short]
%   \move[4]{open up across}
%   \rollawaysashay
%   \move[4]{Neighbor two hand turn}\unskip\moveindex{Two hand turn}%
%
%   \move[8]{Cont.\ two hand turn}\unskip\moveindex{Two hand turn}%
%   \swing*[Melt into a]{8}
%
%   \balanceand\petronella
%   \balanceand\petronella
%   \balanceand\petronella
%   \move[8]{Balance with your partner and two hand turn while rotating to the
%   right to end facing new neighbors}\unskip\moveindex{Balance}\moveindex{Two hand turn}
%   \notes{%
%     Open up with your neighbor in four steps, facing across with leads on the
%     right.%
%   }
% \end{contra}
% \end{exampledance}
%
% \StopEventually{}
% \changes{0.1}{2013/02/09}{Created boilerplate for class}
% \changes{0.3}{2013/02/20}{Split core functionality out into package}
% \changes{0.4}{2013/02/22}{Support swung dances}
% \changes{0.4}{2013/02/22}{Add list of dances}
% \changes{0.4}{2013/02/22}{Add \pkg{tocloft} package to requirements}
% \changes{1.0.0}{2013/09/09}{Start using \href{http://semver.org}{Semantic
% Versioning}}
% \changes{1.0.0}{2013/09/15}{Fix phrase separator issues}
%
% \section{Building and using \pkg{contracard}}
%
% \paragraph{Dependencies} The following dependencies are loaded by
% \pkg{contracard} (you do not need to include them in your project,
% \pkg{contracard} does this for you); before building the \pkg{contracard}
% package you should verify that they are installed.
%
%    \begin{macrocode}
%<*contracard-pkg>
\RequirePackage{calc,intcalc}
\RequirePackage{ifthen}
\RequirePackage{tocloft}
\RequirePackage{textcomp}
%</contracard-pkg>
%    \end{macrocode}
%
% If you're using the class, you'll want the following additional dependencies:
%
%    \begin{macrocode}
%<*contracard-cls>
\AtEndOfClass{\RequirePackage{geometry}}
\AtEndOfClass{\RequirePackage[compact]{titlesec}}
\AtEndOfClass{\RequirePackage{contracard}}
%</contracard-cls>
%    \end{macrocode}
%    \begin{macrocode}
%<*contracard-pkg>
%    \end{macrocode}
%
% \paragraph{Building \pkg{contracard}} Once you have all the required packages,
% building \pkg{contracard} 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 \code{xelatex} against \fname{contracard.dtx}:
%
% \begin{Verbatim}
%   $ xelatex --shell-escape contracard.dtx
% \end{Verbatim}
%
% The \code{-{}-shell-escape} option is only required if you want the output to
% contain version information. This will also require that you have \pkg{git}
% installed (and the git repo itself) as the version is determined by running:
%
% \begin{Verbatim}
%   $ git describe --tags --dirty
% \end{Verbatim}
%
% \paragraph{Using \pkg{contracard}} Building results in two main files, a class
% and a package. In general, if you want to make a calling card, use the
% \pkg{contracard} class and if you want to print a contra dance in a book or
% article, use a different class and require the \pkg{contracard} package.
%
% \subsection{Options}
%
% \hypertarget{CCPACKAGE:OPTIONS}{}
% \begin{macro}{showcountbefore}
% \begin{macro}{showcountafter}
% \begin{macro}{enableidx}
% \changes{1.0.0}{2013/09/08}{New option}
% The package (or class) can also be loaded with the following options. For more
% information about each option, see the command which it calls.
%    \begin{macrocode}
\DeclareOption{showcountafter}{\showcountafter}
\DeclareOption{showcountbefore}{\showcountbefore}
\DeclareOption{enableidx}{\AtEndOfPackage{\enableidx}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \clearpage
% \phantomsection
% \part{The \pkg{contracard} package}
%
% \section{Formatting}
%
% These options determine how the dance will look.
%
% \begin{macro}{\defaultcontraenv}
% \begin{macro}{\dancetitleenv}
% \changes{0.1}{2013/02/14}{Allow user to format moves}
% \changes{0.3}{2013/02/20}{Allow user to format dance title block}
% By default, all contra moves and the title block are wrapped in the
% \code{flushleft} environment. To change this you can renew
% the following macros:
%    \begin{macrocode}
\newcommand*{\defaultcontraenv}{flushleft}
\newcommand*{\dancetitleenv}{flushleft}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\dancetitleformat}
% \begin{macro}{\danceauthorformat}
% \begin{macro}{\danceformformat}
% \changes{0.3}{2013/02/20}{Allow the user to change the dance title format}
% \changes{0.3}{2013/02/20}{Allow the user to change the dance form format}
% To change the formatting of a dance's title, author, or form, redefine the
% following macros:
%    \begin{macrocode}
\newcommand*{\dancetitleformat}{\section*}
\newcommand*{\danceauthorformat}{\subsection*}
\newcommand*{\danceformformat}{\hspace{\fill}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\movedelimiter}
% \changes{0.3}{2013/02/20}{Allow customizing the move delimiter character}
% \begin{macro}{\partdelimiter}
% \changes{0.3}{2013/02/20}{Allow customizing the part delimiter}
% \begin{macro}{\midpartdelimiter}
% \changes{0.3}{2013/02/20}{Allow customizing the mid-part delimiter}
% These commands define delimiters that are used between moves, or at the midway
% point in a part.
%    \begin{macrocode}
\newcommand*{\movedelimiter}{,}
\newcommand*{\partdelimiter}{.}
\newcommand*{\midpartdelimiter}{;}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\phraseseparator}
% \changes{0.4}{2013/02/22}{Allow custom phrase separator character}
% \begin{macro}{\phrasevspace}
% \changes{0.4}{2013/02/22}{Allow custom phrase separation length}
% The \code{\textbackslash phraseseparator} macro is inserted between every
% musical phrase and --- by default --- inserts \code{\textbackslash
% phrasevspace} amount of white space.
%    \begin{macrocode}
\newlength{\phrasevspace}
\setlength{\phrasevspace}{1em}
\newcommand*{\phraseseparator}{\vspace{\phrasevspace}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% A dance with a centered title block, a custom mid-part delimiter (an em-dash
% in this case), and a nice horticultural dingbat as the phrase separator can be
% accomplished with:
%
% \begin{verbatim}
%   \renewcommand*{\dancetitleenv}{center}
%   \renewcommand*{\midpartdelimiter}{\ ---}
%   \renewcommand*{\phraseseparator}{\ding{167}}
% \end{verbatim}
%
% and looks something like this:
%
% \begin{exampledance}
% \renewcommand*{\dancetitleenv}{center}%
% \renewcommand*{\midpartdelimiter}{\ ---}%
% \renewcommand*{\phraseseparator}{\ding{167}}%
% \begin{contra}{Code's Compiling}{Sam Whited}{Duple becket}
%   \dosido*[Neighbor]{8}
%   \seesaw*[Partner]{8}
%   \swing*[Shadow]{16}
%   \balanceand\petronella
%   \balanceand\petronella
%   \swing*[Partner]{8}
%   \rightandleftthrough*[Left diagonal:]
%   \notes{The Neighbor dosido into a partner see saw should be one fluid
%   motion. Resist spinning in the dosido, and start revolving slowly over your
%   right shoulder as you enter the see saw and everything will flow. Make sure
%   lines have \emph{lots} of space for the dosido.}
%   \vspace*{\fill}
%   \begin{flushright}
%   \href{http://creativecommons.org/licenses/by/3.0/}{%
%     \IfFileExists{by.png}{%
%       \includegraphics[width=1cm]{by.png}%
%     }{\cc\by}}
%   \end{flushright}
% \end{contra}
% \end{exampledance}
%
% \begin{macro}{\showcountbefore}
% \changes{1.0.0}{2013/09/07}{Allow showing the count before each move}
% \begin{macro}{\showcountafter}
% \changes{1.0.0}{2013/09/07}{Allow showing the count after each move}
% \begin{macro}{\hidecountbefore}
% \changes{1.0.0}{2013/09/07}{Allow hiding the count before each move}
% \begin{macro}{\hidecountafter}
% \changes{1.0.0}{2013/09/07}{Allow hiding the count after each move}
% These macros allow the user to show or hide the moves duration before or after
% each move.
%    \begin{macrocode}
\newcommand*{\showcountbefore}{\def\@showcountbefore{}}
\newcommand*{\showcountafter}{\def\@showcountafter{}}
\newcommand*{\hidecountbefore}{\let\@showcountbefore\undefined}
\newcommand*{\hidecountafter}{\let\@showcountafter\undefined}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}

% \begin{macro}{\countleftbracket}
% \changes{1.0.0}{2013/09/10}{Add ability to change count brackets}
% \begin{macro}{\countrightbracket}
% \changes{1.0.0}{2013/09/10}{Add ability to change count brackets}
% These commands can be used to set the left and right brackets which are
% inserted on around the count as discussed above. By default, they are set to
% plain left and right parenthesis. Note that these commands take a single
% argument (the new bracket) instead of simply being something that you redefine
% like many of the other formatting commands. They are not used for inserting
% the brackets themselves; just for changing them.
%    \begin{macrocode}
\def\cc@countleftbracket{(}
\def\cc@countrightbracket{)}
\newcommand*{\countleftbracket}[1]{\def\cc@countleftbracket{#1}}
\newcommand*{\countrightbracket}[1]{\def\cc@countrightbracket{#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% For instance, a dance with the count shown afterwards (and the default
% brackets) looks like this:
%
% \begin{exampledance}
% \showcountafter%
% \begin{contra}{Whirling Dervish}{Sam Whited}{Duple improper}
%   \walkaround[neighbor 1\textthreequarters]{8}
%   \move[8]{Men half hey ricochet while ladies cross%
%   \unskip\moveindex{Hey for Four}%
%   \unskip\moveindex{Half Hey}%
%   \unskip\moveindex{Half Hey Ricochet}%
%   \unskip\moveindex{Hey}%
%   }
%   \swing[your partners all]{16}
%   \move[8]{Spin like a Whirling Dervish\moveindex{Whirling Dervish}}
%   \balanceand\petronella
%   \balanceand\move[4]{gents roll neighbor away with a half sashay\moveindex{Half
%   Sashay}\moveindex{Roll Away}\moveindex{Roll Away\ldots Half Sashay}}
%   \move[8]{Balance neighbor and left shoulder round 1 time to new
%   neighbors\moveindex{Balance}\moveindex{Walk around}\moveindex{Left shoulder round}}
%   \notes{A ``Whirling Dervish" is just a circle left in single file except
%   that you should spin over your left shoulder the entire time you're doing
%   it.}
%   \vspace*{\fill}
%   \begin{flushright}
%   \href{http://creativecommons.org/licenses/by/3.0/}{%
%     \IfFileExists{by.png}{%
%       \includegraphics[width=1cm]{by.png}%
%     }{\cc\by}}
%   \end{flushright}
% \end{contra}
% \end{exampledance}
%
% \begin{macro}{\setdefaultnotesenv}
% \changes{1.0.0}{2013/09/10}{Allow changing the default notes environment}
% \begin{macro}{\prenotevspace}
% \changes{1.0.0}{2013/09/10}{Allow changing the default notes vspace}
% You might have noticed the nicely formatted notes in the previous example. By
% default, all notes are set using the \code{flushleft} environment, and with
% \code{\textbackslash fill} amount of vspace before them. This can easily be
% changed with this macro and length.
%    \begin{macrocode}
\def\cc@defaultnotesenv{flushleft}
\newcommand*{\setdefaultnotesenv}[1]{\def\cc@defaultnotesenv{#1}}
\newlength{\prenotevspace}
\setlength{\prenotevspace}{\fill}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \section{Counters}
%
% Lots of counters are used throughout Contra Card for various tasks. The
% following counters do everything from keeping track of the timing, to counting
% the number of moves in a dance.
%
% \subsection{Musical counts}
%
% \begin{macro}{dancecount}
% \begin{macro}{partcount}
% \changes{0.2}{2013/02/15}{Create a counter for the current musical part}
% \changes{0.3}{2013/02/21}{Change to contain the count, not the part itself}
% \begin{macro}{phrasecount}
% \changes{0.2}{2013/02/15}{Create a counter for the current musical phrase}
% \changes{0.3}{2013/02/21}{Change to contain the count, not the phrase itself}
% \begin{macro}{dancepart}
% \changes{0.3}{2013/02/21}{Create a new counter for the current phrase}
% \begin{macro}{dancephrase}
% \changes{0.3}{2013/02/21}{Create a new counter for the current phrase}
% These counters help us keep track of the counts (or `steps') in the dance. The
% \code{dancecount} is reset at the start of each new dance, the
% \code{partcount} is reset at the begining of each part (eg.\ \code{A1} or
% \code{B1}), and the \code{phrasecount} is reset every time the part changes
% (eg.~from \code{A} to \code{B}). The \code{dancepart} and \code{dancephrase}
% counters contain the number of the part of phrase in the dance (instead of the
% number of steps).
%    \begin{macrocode}
\newcounter{dancecount}
\newcounter{partcount}
\newcounter{phrasecount}
\newcounter{dancepart}
\newcounter{dancephrase}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{dancepartlength}
% \changes{0.4}{2013/02/22}{Create a new counter for the part length}
% \begin{macro}{dancephraselength}
% \changes{0.4}{2013/02/22}{Create a new counter for the phrase length}
% \begin{macro}{\resetdancepartlength}
% \changes{1.0.0}{2013/08/12}{Add ability to easily reset counter}
% \begin{macro}{\resetdancephraselength}
% \changes{1.0.0}{2013/08/12}{Add ability to easily reset counter}
% Most contra dances are composed of two 32 count phrases, each with two 16
% count parts, however, it's sometimes useful to change these lengths (for swung
% dances and the like). It's important to fully understand how the move command
% works before modifying these values. Changing just one or the other can have
% unexpected consequences. You can set them back quickly afterwards with the
% reset commands.
%    \begin{macrocode}
\newcounter{dancepartlength}
\newcounter{dancephraselength}
\newcommand*{\resetdancepartlength}{\setcounter{dancepartlength}{16}}
\newcommand*{\resetdancephraselength}{\setcounter{dancephraselength}{32}}
\resetdancepartlength
\resetdancephraselength
%    \end{macrocode}
% For example, if we set the \code{dancepartlength} to 12 and the
% \code{\textbackslash dancephraselength} to 24 (along with some minor tweaks
% for clarity) like so:
%
% \begin{verbatim}
%   \setcounter{dancepartlength}{12}
%   \setcounter{dancephraselength}{24}
%   \showcountafter
% \end{verbatim}
%
% We can create a nice mixer in waltz time:
%
% \begin{exampledance}
% \setcounter{dancepartlength}{12}
% \setcounter{dancephraselength}{24}
% \begin{contra}{Turn Around Waltz}{Sam Whited}{Circle waltz}
%   \showcountafter
%
%   \move[6]{Roll lady on left away}\moveindex{Roll Away}
%   \move[6]{Forward and back}\moveindex{Forward and Back}
%   \move[6]{Roll lady on left away}\moveindex{Roll Away}
%   \move[6]{Forward and back}\moveindex{Forward and Back}
%   \move[6]{Hands out and in, turn out}\moveindex{Turn Alone}
%   \move[6]{Hands in and out, turn in}\moveindex{Turn Alone}
%   \move[6]{Hands out and in ladies cast right}\moveindex{Cast Right}
%   \move[6]{Parallels or free waltz}\moveindex{Parallels}
%
%   \notes{Repeat \textbf{BABB} if dancing to the Nanci Griffith cover of ``Turn
%   Around". Circles of 4 or 8 couples brings you back to your original partner
%   for free waltz at end; for 3 or 7 put partner on your left to start. Get
%   people into square formation, then ask them to merge squares to make things
%   easier.}
% \end{contra}
% \resetdancepartlength
% \resetdancephraselength
% \end{exampledance}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\resetdancephrase}
% \begin{macro}{\resetdancepart}
% \begin{macro}{\resetdancephrase*}
% \begin{macro}{\resetdancepart*}
% \changes{0.2}{2013/02/15}{Allow the user to reset the phrase}
% \changes{0.3}{2013/02/21}{Change name of \code{\textbackslash progressed}}
% The phrase will continue to increment (\code{A}, \code{B}, \code{C}) unless
% the user resets it by calling \code{\textbackslash resetdancephrase}. The user
% can also manually reset the part. If the value of the phrase or part would be
% the same after resetting, no action is taken. You can use the splat version of
% the commands to force a reset (eg.~even if the \code{dancephrase} counter is
% already at 1, the \code{dancephrase} and \code{phrasecount} counters will
% still be reset).
%    \begin{macrocode}
\newcommand*{\resetdancephrase}{%
  \ifthenelse{\value{partcount}=16}{\newline}{}%
  \@ifstar{\@resetdancephraseStar}{\@resetdancephraseNoStar}%
}
\newcommand*{\@resetdancephraseStar}{%
  \setcounter{dancephrase}{1}%
  \setcounter{phrasecount}{0}%
  \setcounter{phrasemovenum}{0}%
  \resetdancepart*%
}
\newcommand*{\@resetdancephraseNoStar}{%
  \ifthenelse{\value{dancephrase}=1}{}{%
    \setcounter{dancephrase}{1}%
    \setcounter{phrasecount}{0}%
    \setcounter{phrasemovenum}{0}%
    \resetdancepart%
  }%
}
\newcommand*{\resetdancepart}{%
  \@ifstar{\@resetdancepartStar}{\@resetdancepartNoStar}%
}
\newcommand*{\@resetdancepartStar}{%
  \setcounter{dancepart}{1}%
  \setcounter{partcount}{0}%
  \setcounter{partmovenum}{0}%
  \setcounter{halfpartmovenum}{0}%
}
\newcommand*{\@resetdancepartNoStar}{%
  \ifthenelse{\value{dancepart}=1}{}{%
    \setcounter{dancepart}{1}%
    \setcounter{partcount}{0}%
    \setcounter{partmovenum}{0}%
    \setcounter{halfpartmovenum}{0}%
  }%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\newdancephrase}
% \changes{0.3}{2013/02/21}{Allow user to manually start a new phrase}
% \begin{macro}{\newdancepart}
% \changes{0.3}{2013/02/21}{Allow user to manually start a new part}
% The user can also manually start a new phrase or part:
%    \begin{macrocode}
\newcommand*{\newdancephrase}{%
  \ifthenelse{\NOT\value{phrasecount}=0}{\par\phraseseparator\par}{}%
  \addtocounter{dancephrase}{1}%
  \setcounter{phrasecount}{0}%
  \setcounter{phrasemovenum}{0}%
  \resetdancepart*%
}
\newcommand*{\newdancepart}{%
  \par\nopagebreak%
  \addtocounter{dancepart}{1}%
  \setcounter{partcount}{0}%
  \setcounter{partmovenum}{0}%
  \setcounter{halfpartmovenum}{0}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% To see how this can be useful consider the following blues contras by caller
% (and all around cat's pajamas) Seth Tepfer. Each one comprises three 16 count
% phrases (\code{A1}, \code{B1}, and \code{C1}). The first employs the
% \code{\textbackslash newdancephrase} command to reset the phrase every 16
% counts, the second changes the \code{dancephraselength} and lets Contra Card
% handle figuring out how to break up the phrases. Both methods produce the same
% result.
%
% \begin{Verbatim}
% \begin{contra}{Untitled Blues \textnumero\ 1}{Seth Tepfer}{Duple minor im.}
%   \setlength{\phrasevspace}{0em}
%   \renewcommand*{\partdelimiter}{:}
%   \walkaround*[Neighbor]{8}
%   \walkaround*[Ladies]{8}
%   \newdancephrase
%   \balanceand*[Partner]\swing{12}
%   \newdancephrase
%   \ladieschain
%   \starleft{8}
%   \vspace*{\fill}
%   \begin{flushright}
%     \href{http://creativecommons.org/licenses/by-nc/3.0/}{%
%       \IfFileExists{by-nc.png}{%
%         \includegraphics[width=1cm]{by-nc.png}%
%        }{\cc\bync}}
%   \end{flushright}
% \end{contra}
% \end{Verbatim}
%
% \begin{exampledance}
% \begin{contra}{Untitled Blues \textnumero\ 1}{Seth Tepfer}{Duple minor im.}
%   \setlength{\phrasevspace}{0em}
%   \renewcommand*{\partdelimiter}{:}
%   \walkaround*[Neighbor]{8}
%   \walkaround*[Ladies]{8}
%   \newdancephrase
%   \balanceand*[Partner]\swing{12}
%   \newdancephrase
%   \ladieschain
%   \starleft{8}
%   \vspace*{\fill}
%   \begin{flushright}
%     \href{http://creativecommons.org/licenses/by-nc/3.0/}{%
%       \IfFileExists{by-nc.png}{%
%         \includegraphics[width=1cm]{by-nc.png}%
%        }{\cc\bync}}
%   \end{flushright}
% \end{contra}
% \end{exampledance}
%
% \clearpage
% \begin{Verbatim}
% \begin{contra}{Untitled Blues \textnumero\ 2}{Seth Tepfer}{Duple minor im.}
%   \setlength{\phrasevspace}{0em}
%   \renewcommand*{\partdelimiter}{:}
%   \setcounter{dancephraselength}{16}
%
%   \walkaround*[Neighbor]{8}
%   \move[8]{Gents allemande\moveindex{Allemande} left 1\textonehalf}
%   \balanceand*[Partner]\swing{12}
%   \move[8]{\textonehalf\ promenade\moveindex{Half Promenade}\moveindex{Promenade} across set}
%   \ladieschain
%   \vspace*{\fill}
%   \begin{flushright}
%     \href{http://creativecommons.org/licenses/by-nc/3.0/}{%
%       \IfFileExists{by-nc.png}{%
%         \includegraphics[width=1cm]{by-nc.png}%
%        }{\cc\bync}}
%   \end{flushright}
% \end{contra}
% \end{Verbatim}
%
% \begin{exampledance}
% \begin{contra}{Untitled Blues \textnumero\ 2}{Seth Tepfer}{Duple minor im.}
%   \setlength{\phrasevspace}{0em}
%   \renewcommand*{\partdelimiter}{:}
%   \setcounter{dancephraselength}{16}
%
%   \walkaround*[Neighbor]{8}
%   \move[8]{Gents allemande\moveindex{Allemande} left 1\textonehalf}
%   \balanceand*[Partner]\swing{12}
%   \move[8]{\textonehalf\ promenade\moveindex{Half Promenade}\moveindex{Promenade} across set}
%   \ladieschain
%   \vspace*{\fill}
%   \begin{flushright}
%     \href{http://creativecommons.org/licenses/by-nc/3.0/}{%
%       \IfFileExists{by-nc.png}{%
%         \includegraphics[width=1cm]{by-nc.png}%
%        }{\cc\bync}}
%   \end{flushright}
% \end{contra}
% \resetdancephraselength
% \end{exampledance}
%
% \subsection{Move counts}

% \begin{macro}{phrasemovenum}
% \changes{1.0.0}{2013/09/05}{Add counter for the number of moves in the phrase}
% \begin{macro}{partmovenum}
% \changes{1.0.0}{2013/09/05}{Add counter for the number of moves in the part}
% \begin{macro}{halfpartmovenum}
% \changes{1.0.0}{2013/09/10}{Add counter for the number of moves in half the part}
% \begin{macro}{dancemovenum}
% \changes{1.0.0}{2013/09/05}{Add counter for the number of moves in the dance}
% The following counters are used to keep track of the number of moves that have
% occurred thus far in the given dance, phrase, or part. They are incremented
% every time \code{\textbackslash move} is called.
%    \begin{macrocode}
\newcounter{phrasemovenum}
\newcounter{partmovenum}
\newcounter{halfpartmovenum}
\newcounter{dancemovenum}
\setcounter{phrasemovenum}{0}
\setcounter{partmovenum}{0}
\setcounter{halfpartmovenum}{0}
\setcounter{dancemovenum}{0}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \section{The \code{contra} environment}
%
% \begin{macro}{contra}
% \changes{0.1}{2013/02/14}{Create contra environment}
% The contra environment is pretty simple. It resets the various counters, and
% displays some information about the dance---if it is used inside of the
% \pkg{contracard} class, it also clears the page and moves the dance form into
% the header.
%    \begin{macrocode}
\newenvironment{contra}[4][\defaultcontraenv]{%
  \global\def\dancetitle{\ignorespaces#2\unskip}
  \global\def\danceauthor{\ignorespaces#3\unskip}
  \global\def\danceform{\ignorespaces#4\unskip}
  \setlength{\parskip}{0.3em plus 0.2em minus 0.3em}
  \refstepcounter{dance}
  \addcontentsline{lod}{dance}{\protect\numberline{\thedance}\ignorespaces#2\unskip}
  \setcounter{dancecount}{0}
  \setcounter{dancemovenum}{0}
  \resetdancepart*
  \resetdancephrase*
  \ifdefined\@ccisclass\clearpage\fi%
  \ifthenelse{\isundefined{\imki@wrindexentry}}{%
    \index{\ignorespaces#4\unskip}
  }{%
    \index[dbt]{\ignorespaces#4\unskip}
    \index[dba]{\ignorespaces#3\unskip}
  }%
  \begin{\dancetitleenv}
    \ifdefined\@ccisclass%
      \pagestyle{myheadings}
      \thispagestyle{myheadings}
      \markboth{}{\danceformformat{\ignorespaces#4\unskip}}
    \else%
      {\danceformformat{\ignorespaces#4\unskip}}%
    \fi%
    {\dancetitleformat{\ignorespaces#2\unskip}}%
    {\danceauthorformat{\ignorespaces#3\unskip}}%
  \end{\dancetitleenv}
  \newcommand*{\@contraenv}{#1}
  \begin{\@contraenv}
%    \end{macrocode}
% The next three lines are worth noting. Any new lines, vertical tabs, or form
% feeds you introduce into your dance won't actually do anything. Contra Card
% attempts to handle line breaks for your, and provides you with hook to insert
% vertical space at the appropriate times.
%    \begin{macrocode}
  \catcode10=9\relax % New line
  \catcode11=9\relax % Vertical Tab
  \catcode12=9\relax % Form Feed
}{%
  \end{\@contraenv}
}
%    \end{macrocode}
% \end{macro}
%
% \section{Moves}
%
% \subsection{The \code{\textbackslash move} command}
%
% \begin{macro}{\move}
% \changes{0.1}{2013/02/14}{Add move command}
% \changes{0.3}{2013/02/21}{Simplify dance logic using new counters}
% \changes{1.0.0}{2013/09/10}{Improve indentation and line spacing}
% \begin{macro}{\move*}
% The meat of the \pkg{contracard} package is contained in the
% \code{\textbackslash move} command.
% This command takes in a move to display, and (optionally) the number of beats
% the move takes.
% If the count is not specified, 8 is used as the default.
%    \begin{macrocode}
\newcommand*{\move}{\@ifstar\@moveStar\@moveNoStar}
\newcommand*{\@moveStar}[2][8]{%
  \def\cc@moveStar{}\@moveNoStar[#1]{#2}\let\cc@moveStar\undefined%
}
\newlength{\cc@partsepwidth}%
\newcommand*{\@balanceAnd}{\ignorespaces}%
\newcommand*{\@extraCount}{0}%
\newcounter{movecount}%
\newcommand*{\@moveNoStar}[2][8]{%
  \setlength{\parindent}{0pt}%
  \setlength{\cc@partsepwidth}{\widthof{\Alph{dancephrase}\arabic{dancepart}%
    \partdelimiter\ }}%
  \setlength{\hangindent}{\cc@partsepwidth}%
  \ifthenelse{\value{phrasecount}=\value{dancephraselength}}{%
    \ifthenelse{\NOT\(#1=0\)}{%
      \newdancephrase%
    }{}%
  }{%
    \ifthenelse{\(\value{partcount}=\value{dancepartlength}\)%
      \AND\NOT\(#1=0\)}{%
      \newdancepart%
    }{}%
  }%
  \ifthenelse{\value{partmovenum}=0}{%
    \Alph{dancephrase}\arabic{dancepart}\partdelimiter\ %
  }{}%
  \setcounter{movecount}{0}%
  \addtocounter{movecount}{#1}%
  \addtocounter{movecount}{\@extraCount}%
  \addtocounter{dancecount}{\value{movecount}}%
  \addtocounter{phrasecount}{\value{movecount}}%
  \addtocounter{partcount}{\value{movecount}}%
  \addtocounter{phrasemovenum}{1}%
  \addtocounter{partmovenum}{1}%
  \addtocounter{halfpartmovenum}{1}%
  \addtocounter{dancemovenum}{1}%
  \ifthenelse{\isundefined{\@showcountbefore}\OR\(\value{movecount}=0\)}{%
    \relax%
  }{\cc@countleftbracket\ignorespaces\themovecount\unskip\cc@countrightbracket~}%
  \@balanceAnd#2\unskip%
  \ifthenelse{\isundefined{\@showcountafter}\OR\(\value{movecount}=0\)}{%
    \relax%
  }{~\cc@countleftbracket\ignorespaces\themovecount\unskip\cc@countrightbracket}%
  \ifthenelse{\NOT\(\value{movecount}=0\)}{%
    \ifthenelse{\value{partcount}=\intcalcDiv{\value{dancepartlength}}{2}}{%
      \setcounter{halfpartmovenum}{0}%
    }{}%
    \ifx\cc@moveStar\undefined%
      \ifthenelse{\value{partcount}=\intcalcDiv{\value{dancepartlength}}{2}}{%
        \midpartdelimiter\looseness=-1\linebreak[1]\space\nopagebreak\ignorespaces%
      }{%
        \ifthenelse{\NOT\value{partcount}=\value{dancepartlength}}{%
          \movedelimiter\nolinebreak[2]\space\nopagebreak\ignorespaces%
        }{}%
      }%
    \fi%
  }{}%
  \renewcommand*{\@balanceAnd}{\ignorespaces}%
  \renewcommand*{\@extraCount}{0}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsection{Move shortcuts}
%
% Often you may find yourself copy and pasting common moves that have the same
% timing, wording, etc. For times like this \pkg{contracard} provides a number
% of shortcut macros.
%
% \begin{macro}{\allemande}
% \changes{1.0.0}{2013/09/05}{Add move shortcut}
% \begin{macro}{\allemande*}
% \changes{1.0.0}{2013/09/05}{Add move shortcut}
% The allemande macro takes two mandatory arguments: the count, and the
% direction to allemande. It also takes the person to allemande (eg.~shadow,
% partner, neighbor, etc.) as an optional first argument.
%    \begin{macrocode}
\newcommand*{\allemande}{%
  \moveindex{Allemande}%
  \@ifstar\@allemandeStar\@allemandeNoStar%
}
\newcommand*{\@allemandeNoStar}[3][\unskip]{%
  \move[#2]{Allemande \ignorespaces#3\unskip\ \ignorespaces#1\unskip}%
}
\newcommand*{\@allemandeStar}[3][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[#2]{\ignorespaces#1\unskip\ allemande \ignorespaces#3\unskip}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\balance}
% \changes{1.0.0}{2013/09/05}{Add move shortcut}
% \begin{macro}{\balance*}
% \changes{1.0.0}{2013/09/05}{Add move shortcut}
% \begin{macro}{\balanceand}
% \changes{1.0.0}{2013/09/05}{Add move shortcut}
% \changes{2.0.0}{2019/02/28}{Now modifies count and text of next move}
% \begin{macro}{\balanceand*}
% \changes{1.0.0}{2013/09/05}{Add move shortcut}
% \changes{2.0.0}{2019/02/28}{Now modifies count and text of next move}
% The \code{\textbackslash balance} macro takes a single optional argument and
% prints it after (or before if you use \code{\textbackslash balance*}) the word
% `balance'. Balances always take up 4 beats.
% If \code{\textbackslash balanceand} or \code{\textbackslash balanceand*} is
% used, the balance won't be counted as a separate move.
% Instead, its count (and the text) will be added to the next move used.
%    \begin{macrocode}
\newcommand*{\balance}{%
  \moveindex{Balance}%
  \@ifstar\@balanceStar\@balanceNoStar%
}
\newcommand*{\@balanceNoStar}[1][\unskip]{%
  \move[4]{Balance \ignorespaces#1\unskip}%
}
\newcommand*{\@balanceStar}[1][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[4]{\ignorespaces#1\unskip\ balance}%
}
\newcommand*{\balanceand}{%
  \cc@checkphrasestart%
  \moveindex{Balance}%
  \@ifstar\@balanceandStar\@balanceandNoStar%
}
\newcommand*{\@balanceandNoStar}[1][]{%
  \renewcommand*{\@balanceAnd}{Balance and \ignorespaces#1\unskip\ \expandafter\ignorespaces\expandafter\MakeLowercase}%
  \renewcommand*{\@extraCount}{4}%
}
\newcommand*{\@balanceandStar}[1][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \renewcommand*{\@balanceAnd}{\ignorespaces#1\unskip\ balance and\ \expandafter\ignorespaces\expandafter\MakeLowercase}%
  \renewcommand*{\@extraCount}{4}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\butterflywhirl}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% \begin{macro}{\butterflywhirl*}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% Both versions of \code{\textbackslash butterflywhirl} also take in an optional
% string representing the other dance (eg.~partner, neighbor, etc.) and the
% count as arguments.
%    \begin{macrocode}
\newcommand*{\butterflywhirl}{%
  \moveindex{Butterfly Whirl}%
  \@ifstar\@butterflyStar\@butterflyNoStar%
}
\newcommand*{\@butterflyNoStar}[2][\unskip]{%
  \move[#2]{Butterfly whirl \ignorespaces#1\unskip}%
}
\newcommand*{\@butterflyStar}[2][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[#2]{\ignorespaces#1\unskip\ butterfly whirl}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\circleleft}
% \changes{1.0.0}{2013/09/12}{Add move shortcut}
% \begin{macro}{\circleleft*}
% \changes{1.0.0}{2013/09/12}{Add move shortcut}
% \begin{macro}{\circleright}
% \changes{1.0.0}{2013/09/12}{Add move shortcut}
% \begin{macro}{\circleright*}
% \changes{1.0.0}{2013/09/12}{Add move shortcut}
% Here are a few commands to deal with circles. As usual, there is an optional
% argument (in case you need to say something like ``Gents circle left" or
% ``Circle left 1 time `round") and a mandatory argument (the number of beats to
% circle).
%    \begin{macrocode}
\newcommand*{\circleleft}{%
  \moveindex{Circle Left}%
  \def\cc@dir{left}%
  \@ifstar\@circleStar\@circleNoStar%
}
\newcommand*{\circleright}{%
  \moveindex{Circle Right}%
  \def\cc@dir{right}%
  \@ifstar\@circleStar\@circleNoStar%
}
\newcommand*{\@circleNoStar}[2][\unskip]{%
  \move[#2]{Circle \cc@dir\ \ignorespaces#1\unskip}%
}
\newcommand*{\@circleStar}[2][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[#2]{\ignorespaces#1\unskip\ circle \cc@dir}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\courtesyturn}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% \begin{macro}{\courtesyturn*}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% Like most of the move shortcut macros, these take an optional person to turn,
% and the number of beats. The star version of the command tweaks the wording a
% bit.
%    \begin{macrocode}
\newcommand*{\courtesyturn}{%
  \moveindex{Courtesy Turn}%
  \@ifstar\@courtesyturnStar\@courtesyturnNoStar%
}
\newcommand*{\@courtesyturnNoStar}[2][\unskip]{%
  \move[#2]{Courtesy turn \ignorespaces#1\unskip}%
}
\newcommand*{\@courtesyturnStar}[2][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[#2]{\ignorespaces#1\unskip\ courtesy turn}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\dosido}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% \begin{macro}{\dosido*}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% \begin{macro}{\seesaw}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% \begin{macro}{\seesaw*}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% These commands create a dosido (aka \word{do-si-do}, \word{do-se-do},
% \word{dosado}, \word{dos-\`a-dos}, etc.) or a see saw (left shoulder dosido).
%    \begin{macrocode}
\newcommand*{\dosido}{%
  \moveindex{\spellDosido}%
  \@ifstar\@dosidoStar\@dosidoNoStar%
}
\newcommand*{\@dosidoNoStar}[2][\unskip]{%
  \move[#2]{\spellDosido\ \ignorespaces#1\unskip}%
}
\newcommand*{\@dosidoStar}[2][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[#2]{\ignorespaces#1\unskip\ \spelldosido}%
}
\newcommand*{\seesaw}{%
  \moveindex{See Saw}%
  \@ifstar\@seesawStar\@seesawNoStar%
}
\newcommand*{\@seesawNoStar}[2][\unskip]{%
  \move[#2]{See saw \ignorespaces#1\unskip}%
}
\newcommand*{\@seesawStar}[2][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[#2]{\ignorespaces#1\unskip\ see saw}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\walkaround}
% \changes{2.0.0}{2019/02/17}{Rename move}
% \begin{macro}{\walkaround*}
% \changes{2.0.0}{2019/02/17}{Rename move}
% \begin{macro}{\walkaroundleft}
% \changes{2.0.0}{2019/02/17}{Rename move}
% \begin{macro}{\walkaroundleft*}
% \changes{2.0.0}{2019/02/17}{Rename move}
% \begin{macro}{\walkaroundright}
% \changes{2.0.0}{2019/02/17}{Rename move}
% \begin{macro}{\walkaroundright*}
% \changes{2.0.0}{2019/02/17}{Rename move}
% Several different macros exist for creating walk arounds (sometimes right or
% left shoulder round).
% You can create a direction agnostic version with the \code{\textbackslash
% walkaround} macro, while the \code{\textbackslash walkaroundleft} and
% \code{\textbackslash walkaroundright} macros use the ``shoulder round" variant
% and include the direction, they also index the move under the given direction.
%
% For information about the terminology, see appendix \ref{appendix:notation}.
%    \begin{macrocode}
\newcommand*{\walkaround}{%
  \moveindex{Walk around}%
  \@ifstar\@walkAroundStar\@walkAroundNoStar%
}
\newcommand*{\walkaroundright}{%
  \moveindex{Walk around}%
  \moveindex{Right shoulder round}%
  \def\cc@thedir{right}%
  \@ifstar\@walkAroundDirStar\@walkAroundDirNoStar%
}
\newcommand*{\walkaroundleft}{%
  \moveindex{Walk around}%
  \moveindex{Left shoulder round}%
  \def\cc@thedir{left}%
  \@ifstar\@walkAroundDirStar\@walkAroundDirNoStar%
}
\newcommand*{\@walkAroundNoStar}[2][\unskip]{%
  \move[#2]{Walk around \ignorespaces#1\unskip}%
}
\newcommand*{\@walkAroundStar}[2][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[#2]{\ignorespaces#1\unskip\ walk around}%
}
\newcommand*{\@walkAroundDirNoStar}[2][\unskip]{%
  \move[#2]{\cc@thedir\ shoulder round \ignorespaces#1\unskip}%
}
\newcommand*{\@walkAroundDirStar}[2][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[#2]{\ignorespaces#1\unskip\ \cc@thedir\ shoulder round}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\heyforfour}
% \changes{1.0.0}{2013/09/12}{Add move shortcut}
% \begin{macro}{\heyforfour*}
% \changes{1.0.0}{2013/09/12}{Add move shortcut}
% \begin{macro}{\halfhey}
% \changes{1.0.0}{2013/09/12}{Add move shortcut}
% \begin{macro}{\halfhey*}
% \changes{1.0.0}{2013/09/12}{Add move shortcut}
% \begin{macro}{\halfheyricochet}
% \changes{1.0.0}{2013/09/12}{Add move shortcut}
% \begin{macro}{\halfheyricochet*}
% \changes{1.0.0}{2013/09/12}{Add move shortcut}
% \begin{macro}{\fullhey}
% \changes{1.0.0}{2013/09/12}{Add move shortcut}
% \begin{macro}{\fullhey*}
% \changes{1.0.0}{2013/09/12}{Add move shortcut}
% \begin{macro}{\fullheyricochet}
% \changes{2.0.0}{2019/03/03}{Add move shortcut}
% \begin{macro}{\fullheyricochet*}
% \changes{2.0.0}{2019/03/03}{Add move shortcut}
% These macros produce various kinds of hey. Though `hey for four' is often used
% to indicate `half a hey` we define `hey for four` and `full hey' to be the
% same thing.
%    \begin{macrocode}
\newcommand*{\heyforfour}{%
  \moveindex{Hey}%
  \moveindex{Hey for Four}%
  \moveindex{Full Hey}%
  \@ifstar\@heyforfourStar\@heyforfourNoStar%
}
\newcommand*{\@heyforfourNoStar}[1][\unskip]{%
  \move[16]{Hey for four \ignorespaces#1\unskip}
}
\newcommand*{\@heyforfourStar}[1][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[16]{\ignorespaces#1\unskip\ hey for four}
}
\newcommand*{\halfhey}{%
  \moveindex{Hey}%
  \moveindex{Hey for Four}%
  \moveindex{Half Hey}%
  \@ifstar\@halfheyStar\@halfheyNoStar%
}
\newcommand*{\@halfheyNoStar}[1][\unskip]{%
  \move[8]{Half a hey \ignorespaces#1\unskip}
}
\newcommand*{\@halfheyStar}[1][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[8]{\ignorespaces#1\unskip\ half a hey}
}
\newcommand*{\halfheyricochet}{%
  \moveindex{Hey}%
  \moveindex{Hey for Four}%
  \moveindex{Half Hey}%
  \moveindex{Half Hey Ricochet}%
  \@ifstar\@halfheyricochetStar\@halfheyricochetNoStar%
}
\newcommand*{\@halfheyricochetNoStar}[1][\unskip]{%
  \move[8]{Half hey ricochet \ignorespaces#1\unskip}
}
\newcommand*{\@halfheyricochetStar}[1][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[8]{\ignorespaces#1\unskip\ half hey ricochet}
}
\newcommand*{\fullhey}{%
  \moveindex{Hey}%
  \moveindex{Hey for Four}%
  \moveindex{Full Hey}%
  \@ifstar\@fullheyStar\@fullheyNoStar%
}
\newcommand*{\@fullheyNoStar}[1][\unskip]{%
  \move[16]{Full hey \ignorespaces#1\unskip}
}
\newcommand*{\@fullheyStar}[1][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[16]{\ignorespaces#1\unskip\ full hey}
}
\newcommand*{\fullheyricochet}{%
  \moveindex{Hey}%
  \moveindex{Hey for Four}%
  \moveindex{Full Hey}%
  \moveindex{Full Hey Ricochet}%
  \@ifstar\@fullheyricochetStar\@fullheyricochetNoStar%
}
\newcommand*{\@fullheyricochetNoStar}[1][\unskip]{%
  \move[16]{Full hey ricochet \ignorespaces#1\unskip}
}
\newcommand*{\@fullheyricochetStar}[1][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[16]{\ignorespaces#1\unskip\ full hey ricochet}
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{exampledance}
% \begin{contra}{East Meets West}{Martha Wild}{Duple improper}
%   \longlines
%   \move{Walk around star \textthreequarters}\moveindex{Walk Around Star}
%   \move[16]{Right shoulder round and swing partner}\moveindex{Walk around}%
%     \moveindex{Right shoulder round}\moveindex{Swing}
%   \halfpromenade
%   \move{Hey}\moveindex{Hey}\moveindex{Hey for Four}\moveindex{Full Hey}
%   \move{(continue hey)}
%   \ladieschain
% \end{contra}
% \end{exampledance}
%
% \begin{macro}{\ladieschain}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% \begin{macro}{\ladieschain*}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% \begin{macro}{\menchain}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% \begin{macro}{\menchain*}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% \begin{macro}{\halfladieschain}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% \begin{macro}{\halfladieschain*}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% \begin{macro}{\halfmenchain}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% \begin{macro}{\halfmenchain*}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% \begin{macro}{\fullladieschain}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% \begin{macro}{\fullladieschain*}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% \begin{macro}{\fullmenchain}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% \begin{macro}{\fullmenchain*}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% The ladies chain (and it's less common variant for men) is actually a half of
% a ladies chain. The full ladies chain is often simply called as two ladies
% chains, however, the alternate full ladies chain commands are provided
% anyways. A set of commands for half ladies chains are also provided; these are
% exactly like the normal ladies chain commands except they include the word
% `half' in the output.
%    \begin{macrocode}
\newcommand*{\ladieschain}{%
  \moveindex{Ladies Chain}%
  \def\cc@who{ladies}%
  \@ifstar\@chainStar\@chainNoStar%
}
\newcommand*{\menchain}{%
  \moveindex{Men Chain}%
  \def\cc@who{men}%
  \@ifstar\@chainStar\@chainNoStar%
}
\newcommand*{\@chainNoStar}[1][\unskip]{%
  \move[8]{\expandafter\MakeUppercase\cc@who\ chain \ignorespaces#1\unskip}%
}
\newcommand*{\@chainStar}[1][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[8]{\ignorespaces#1\unskip\ \cc@who\ chain}%
}
\newcommand*{\halfladieschain}{%
  \moveindex{Half Ladies Chain}%
  \def\cc@who{ladies}%
  \@ifstar\@halfchainStar\@halfchainNoStar%
}
\newcommand*{\halfmenchain}{%
  \moveindex{Half Men Chain}%
  \def\cc@who{men}%
  \@ifstar\@halfchainStar\@halfchainNoStar%
}
\newcommand*{\@halfchainNoStar}[1][\unskip]{%
  \move[8]{\expandafter\MakeUppercase\cc@who\ half chain \ignorespaces#1\unskip}%
}
\newcommand*{\@halfchainStar}[1][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[8]{\ignorespaces#1\unskip\ \cc@who\ half chain}%
}
\newcommand*{\fullladieschain}{%
  \moveindex{Full Ladies Chain}%
  \def\cc@who{ladies}%
  \@ifstar\@fullchainStar\@fullchainNoStar%
}
\newcommand*{\fullmenchain}{%
  \moveindex{Full Men Chain}%
  \def\cc@who{men}%
  \@ifstar\@fullchainStar\@fullchainNoStar%
}
\newcommand*{\@fullchainNoStar}[1][\unskip]{%
  \move[16]{\expandafter\MakeUppercase\cc@who\ full chain \ignorespaces#1\unskip}%
}
\newcommand*{\@fullchainStar}[1][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[16]{\ignorespaces#1\unskip\ \cc@who\ full chain}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lines}
% \changes{1.0.0}{2013/09/11}{Add move shortcut}
% \begin{macro}{\lines*}
% \changes{1.0.0}{2013/09/11}{Add move shortcut}
% \begin{macro}{\longlines}
% \changes{1.0.0}{2013/09/11}{Add move shortcut}
% \begin{macro}{\longlines*}
% \changes{1.0.0}{2013/09/11}{Add move shortcut}
% The \code{\textbackslash lines} macro (lines forward and back) takes a single
% optional argument: The type of lines (eg. `short', `long', etc.). Using the
% starred version of the command tells the lines to go forward (4 counts) but
% not back. Since ``long lines forward and back" is such a common figure, an
% alias is provided just for that.
%    \begin{macrocode}
\newcommand*{\lines}{%
  \moveindex{Lines Forward and Back}%
  \@ifstar\@linesStar\@linesNoStar%
}
\newcommand*{\@linesNoStar}[1][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[8]{\ignorespaces#1\unskip\ lines forward and back}%
}
\newcommand*{\@linesStar}[1][lines]{%
  \move[4]{\ignorespaces#1\unskip\ lines forward}%
}
\newcommand*{\longlines}{%
  \moveindex{Long Lines Forward and Back\ \seealso{Lines Forward and Back}{X}}%
  \@ifstar\@longlinesStar\@longlinesNoStar%
}
\newcommand*{\@longlinesNoStar}{%
  \lines[Long]%
}
\newcommand*{\@longlinesStar}{%
  \lines*[Long]%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\madrobin}
% \changes{2.0.0}{2018/07/24}{New macro}
% \begin{macro}{\madrobin*}
% \changes{2.0.0}{2018/07/24}{New macro}
% The Mad Robin (sometimes called ``Sashay 'round") always takes up 8 full
% beats.
% The star version of the command inserts the optional argument before the text
% ``mad robin" instead of after it.
%    \begin{macrocode}
\newcommand*{\madrobin}{%
  \moveindex{Mad Robin}%
  \@ifstar\@madrobinStar\@madrobinNoStar%
}
\newcommand*{\@madrobinNoStar}[1][\unskip]{%
  \move[8]{Mad robin \ignorespaces#1\unskip}%
}
\newcommand*{\@madrobinStar}[1][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[8]{\ignorespaces#1\unskip\ mad robin}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\petronella}
% \changes{1.0.0}{2013/09/08}{Add move shortcut}
% \begin{macro}{\petronella*}
% \changes{1.0.0}{2013/09/08}{Add move shortcut}
% \begin{macro}{\petronellanella}
% \changes{1.1.0}{2018/07/21}{Add nella-nella petronella variants}
% \begin{macro}{\petronellanella*}
% \changes{1.1.0}{2018/07/21}{Add nella-nella petronella variants}
% Petronella's are normally performed in rings of four, and aren't with another
% individual, however, the \code{\textbackslash petronella} macro still takes a
% single optional argument for those rare occasions when two individuals are
% turning in a diamond pattern.
% A petronella-nella has the same timing as a normal petronella but instead of
% moving one place to the right dancers move two places.
% \begin{exampledance}
% \begin{contra}{Snowball Shimmy}{Seth Tepfer}{Duple becket}
%   \move[8]{Circle left all the way}
%   \allemande*[Gents]{8}{left 1\textonehalf}
%   \balanceand\swing[neighbor]{12}
%   \balanceand\petronella
%   \balanceand\petronellanella
%   \balanceand\swing[partner]{12}
%   \notes{nella-nella variant of Erik Weberg's Wasatch Wiggle}
% \end{contra}
% \end{exampledance}
%    \begin{macrocode}
\newcommand*{\petronella}{%
  \moveindex{Petronella}%
  \@ifstar\@petronellaStar\@petronellaNoStar%
}
\newcommand*{\@petronellaNoStar}[1][\unskip]{%
  \move[4]{Petronella \ignorespaces#1\unskip}%
}
\newcommand*{\@petronellaStar}[1][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[4]{\ignorespaces#1\unskip\ petronella}%
}
\newcommand*{\petronellanella}{%
  \moveindex{Petronella}%
  \moveindex{Petronella-nella}%
  \@ifstar\@petronellanellaStar\@petronellanellaNoStar%
}
\newcommand*{\@petronellanellaNoStar}[1][\unskip]{%
  \move[4]{Petronella-nella \ignorespaces#1\unskip}%
}
\newcommand*{\@petronellanellaStar}[1][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[4]{\ignorespaces#1\unskip\ petronella-nella}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\promenade}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% \begin{macro}{\promenade*}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% \begin{macro}{\halfpromenade}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% \begin{macro}{\halfpromenade*}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% The \code{\textbackslash promenade} and \code{\textbackslash halfpromenade}
% commands work slightly differently. Both take the person (or direction) you're
% promenading as the optional argument, but the \code{\textbackslash promenade}
% command also takes a mandatory argument (the number of beats) while
% \code{\textbackslash halfpromenade} command is fixed at 8 beats.
%    \begin{macrocode}
\newcommand*{\promenade}{%
  \moveindex{Promenade}
  \@ifstar\@promenadeStar\@promenadeNoStar%
}
\newcommand*{\@promenadeNoStar}[2][\unskip]{%
  \move[#2]{Promenade \ignorespaces#1\unskip}%
}
\newcommand*{\@promenadeStar}[2][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[#2]{\ignorespaces#1\unskip\ promenade}%
}
\newcommand*{\halfpromenade}{%
  \moveindex{Promenade}%
  \moveindex{Half Promenade}%
  \@ifstar\@halfpromenadeStar\@halfpromenadeNoStar%
}
\newcommand*{\@halfpromenadeNoStar}[1][\unskip]{%
  \move[8]{Half promenade \ignorespaces#1\unskip}%
}
\newcommand*{\@halfpromenadeStar}[1][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[8]{\ignorespaces#1\unskip\ half promenade}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\rightandleftthrough}
% \changes{1.0.0}{2013/09/08}{Add move shortcut}
% \begin{macro}{\rightandleftthrough*}
% \changes{1.0.0}{2013/09/08}{Add move shortcut}
% \begin{macro}{\rightsandlefts}
% \changes{1.0.0}{2013/09/08}{Add move shortcut}
% \begin{macro}{\rightsandlefts*}
% \changes{1.0.0}{2013/09/08}{Add move shortcut}
% Creates a right and left through (aka. rights and lefts). These always take up
% 8 counts.
%    \begin{macrocode}
\newcommand*{\rightandleftthrough}{%
  \moveindex{Right and left through}%
  \moveindex{Rights and lefts|seealso{Right and left through}}%
  \@ifstar\@rlStar\@rlNoStar%
}
\newcommand*{\rightsandlefts}{%
  \moveindex{Right and left through}%
  \moveindex{Rights and lefts|seealso{Right and left through}}%
  \@ifstar\@rlStar\@rlNoStar%
}
\newcommand*{\@rlNoStar}[1][\unskip]{%
  \move[8]{Right and left through \ignorespaces#1\unskip}%
}
\newcommand*{\@rlStar}[1][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[8]{\ignorespaces#1\unskip\ right and left through}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\rollaway}
% \changes{1.0.0}{2013/09/10}{Add move shortcut}
% \changes{2.0.0}{2018/07/25}{Breaking change to allow complex notation}
% \begin{macro}{\rollaway*}
% \changes{1.0.0}{2013/09/10}{Add move shortcut}
% \changes{2.0.0}{2018/07/25}{Breaking change to allow complex notation}
% \begin{macro}{\rollawaysashay}
% \changes{2.0.0}{2018/07/25}{Renamed from ``\texttt{\textbackslash rollawayhalfsashay}''}
% \begin{macro}{\rollawaysashay*}
% \changes{2.0.0}{2018/07/25}{Renamed from ``\texttt{\textbackslash rollawayhalfsashay*}''}
% ``Roll away" and ``roll away with a half sashay" may sound similar, but the
% macros that produce them are a bit different. The \code{\textbackslash
% rollaway} macro works exactly like most macros here: It takes a single
% optional argument, and the star version rewords things a bit (it takes no
% count argument since that's always 4 beats for this figure).
% The \code{\textbackslash rollawaysashay} macro on the other hand, takes a
% single optional argument unless you use the splat version in which case it
% takes a single optional argument \emph{and} a required argument.
% This allows you to reword things (just like the other commands) by leaving off
% the optional argument, but also allows you to make more complicated roll aways
% such as \code{\textbackslash rollawaysashay*{[the gents]}\{Ladies\}} which
% would be typeset as: ``Ladies roll the gents away with a half sashay".
%    \begin{macrocode}
\newcommand*{\rollaway}{%
  \moveindex{Roll away}%
  \@ifstar\@rollawayStar\@rollawayNoStar%
}
\newcommand*{\rollawaysashay}{%
  \moveindex{Roll Away}%
  \moveindex{Roll Away with a Half Sashay}%
  \moveindex{Half Sashay}%
  \@ifstar\@rawhsStar\@rawhsNoStar%
}
\newcommand*{\@rollawayNoStar}[1][\unskip]{%
	\move[4]{Roll \ignorespaces#1\unskip\ away}%
}
\newcommand*{\@rollawayStar}[3][\unskip]{%
  \move[4]{\ignorespaces#2\unskip\ roll \ignorespaces#3\unskip\ away \ignorespaces#1\unskip}%
}
\newcommand*{\@rawhsNoStar}[1][\unskip]{%
  \move[4]{Roll \ignorespaces#1\unskip\ away with a half sashay}%
}
\newcommand*{\@rawhsStar}[3][\unskip]{%
  \move[4]{\ignorespaces#2\unskip\ roll \ignorespaces#3\unskip\ away with a half sashay \ignorespaces#1\unskip}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\starleft}
% \changes{1.0.0}{2013/09/09}{Add move shortcut}
% \begin{macro}{\starleft*}
% \changes{1.0.0}{2013/09/09}{Add move shortcut}
% \begin{macro}{\starright}
% \changes{1.0.0}{2013/09/09}{Add move shortcut}
% \begin{macro}{\starright*}
% \changes{1.0.0}{2013/09/09}{Add move shortcut}
% Though `star left' and `star right' are really the same move (in different
% directions), there are two separate macros since there aren't any other
% directions you can star.
%    \begin{macrocode}
\newcommand*{\starleft}{%
  \moveindex{Star}%
  \moveindex{Left hand star}%
  \def\cc@dir{Left}%
  \@ifstar\@starStar\@starNoStar%
}
\newcommand*{\starright}{%
  \moveindex{Star}%
  \moveindex{Right hand star}%
  \def\cc@dir{right}%
  \@ifstar\@starStar\@starNoStar%
}
\newcommand*{\@starNoStar}[1]{%
  \move[#1]{\cc@dir\ hand star}%
}
\newcommand*{\@starStar}[1]{%
  \move[#1]{Star \cc@dir}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\sashay}
% \changes{1.0.0}{2013/09/10}{Add move shortcut}
% \begin{macro}{\sashay*}
% \changes{1.0.0}{2013/09/10}{Add move shortcut}
% The sashay command, like \code{\textbackslash rollawaysashay} takes a
% different number of arguments if you use the starred version.
% The normal version takes an optional argument and the required count, while
% the starred version takes the same optional argument, the required count, and
% another required argument.
% For instance, \code{\textbackslash sashay*{[down and back]}\{8\}\{Ladies\}}
% would create the move: ``Ladies sashay down and back''.
%    \begin{macrocode}
\newcommand*{\sashay}{%
  \moveindex{Sashay}%
  \@ifstar\@sashayStar\@sashayNoStar%
}
\newcommand*{\@sashayNoStar}[2][\unskip]{%
  \move[#2]{Sashay \ignorespaces#1\unskip}%
}
\newcommand*{\@sashayStar}[3][\unskip]{%
  \move[#2]{\ignorespaces#3\unskip\ sashay \ignorespaces#1\unskip}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\swing}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% \begin{macro}{\swing*}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% Creates a basic swing. Probably the most common move in modern contra dance,
% and also one of the simplest commands in this package.
%    \begin{macrocode}
\newcommand*{\swing}{%
  \moveindex{Swing}%
  \@ifstar\@swingStar\@swingNoStar%
}
\newcommand*{\@swingNoStar}[2][\unskip]{%
  \move[#2]{Swing \ignorespaces#1\unskip}%
}
\newcommand*{\@swingStar}[2][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[#2]{\ignorespaces#1\unskip\ swing}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\turnalone}
% \changes{1.0.0}{2013/09/10}{Add move shortcut}
% \begin{macro}{\turnalone*}
% \changes{1.0.0}{2013/09/10}{Add move shortcut}
% \begin{macro}{\turncouple}
% \changes{1.0.0}{2013/09/10}{Add move shortcut}
% \begin{macro}{\turncouple*}
% \changes{1.0.0}{2013/09/10}{Add move shortcut}
% \begin{macro}{\turntogether}
% \changes{1.0.0}{2013/09/10}{Add move shortcut}
% \begin{macro}{\turntogether*}
% \changes{1.0.0}{2013/09/10}{Add move shortcut}
% ``Turn alone" and ``Turn as a couple" aren't exactly dance figures; just
% directions that are often placed at the end of other figures. For this reason,
% they all take up 0 logical counts of music and should be prepended to other
% commands. The normal commands take an optional argument which can be used to
% add some text after `alone' or `couple'. The starred version of each command
% is exactly the same, except that it also has a required argument, a number of
% counts (for those times when you want it to actually take up time in the music
% and not just be part of another move).
%    \begin{macrocode}
\newcommand*{\turnalone}{%
  \moveindex{Turn Alone}%
  \def\cc@who{alone}%
  \@ifstar\@turnStar\@turnNoStar%
}
\newcommand*{\turncouple}{%
  \moveindex{Turn as a Couple}%
  \moveindex{Turn Together|see{Turn as a Couple}}%
  \def\cc@who{as a couple}%
  \@ifstar\@turnStar\@turnNoStar%
}
\newcommand*{\turntogether}{%
  \moveindex{Turn as a Couple}%
  \moveindex{Turn Together|see{Turn as a Couple}}%
  \def\cc@who{together}%
  \@ifstar\@turnStar\@turnNoStar%
}
\newcommand*{\@turnNoStar}[1][\unskip]{%
  \cc@checkphrasestart%
  \move*[0]{Turn \cc@who\ \ignorespaces#1\unskip\ \ \ignorespaces}%
}
\newcommand*{\@turnStar}[2][\unskip]{%
  \move[#2]{Turn \cc@who\ \ignorespaces#1\unskip}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\twirltoswap}
% \changes{1.0.0}{2013/09/11}{Add move shortcut}
% \begin{macro}{\californiatwirl}
% \changes{1.0.0}{2013/09/11}{Add move shortcut}
% \begin{macro}{\starthrough}
% \changes{1.0.0}{2013/09/11}{Add move shortcut}
% \begin{macro}{\starthru}
% \changes{1.0.0}{2013/09/11}{Add move shortcut}
% \begin{macro}{\boxthegnat}
% \changes{1.0.0}{2013/09/11}{Add move shortcut}
% \begin{macro}{\swattheflea}
% \changes{1.0.0}{2013/09/11}{Add move shortcut}
% \begin{macro}{\jerseytwirl}
% \changes{1.0.0}{2013/09/11}{Add move shortcut}
% \begin{macro}{\arizonatwirl}
% \changes{1.0.0}{2013/09/11}{Add move shortcut}
% ``Twirl to Swap" is probably in the running for having the most variations of
% any Contra dance move. A few of the more common ones are presented here. They
% don't take any arguments, and there aren't any starred versions. Just simple,
% 4 count moves.
%    \begin{macrocode}
\newcommand*{\twirltoswap}{%
  \moveindex{Twirl to Swap}%
  \move[4]{Twirl to swap}%
}
\newcommand*{\californiatwirl}{%
  \moveindex{California Twirl}%
  \move[4]{California twirl}%
}
\newcommand*{\starthrough}{%
  \moveindex{Star Through}%
  \move[4]{Star through}%
}
\newcommand*{\starthru}{%
  \moveindex{Star Thru|see{Star Through}}%
  \moveindex{Star Through}%
  \move[4]{Star thru}%
}
\newcommand*{\boxthegnat}{%
  \moveindex{Box the Gnat}%
  \move[4]{Box the gnat}%
}
\newcommand*{\swattheflea}{%
  \moveindex{Swat the Flea}%
  \move[4]{Swat the flea}%
}
\newcommand*{\jerseytwirl}{%
  \moveindex{Jersey Twirl}%
  \move[4]{Jersey twirl}%
}
\newcommand*{\arizonatwirl}{%
  \moveindex{Arizona Twirl}%
  \move[4]{Arizona twirl}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\downthehall}
% \changes{1.0.0}{2013/09/12}{Add move shortcut}
% \begin{macro}{\downthehall*}
% \changes{1.0.0}{2013/09/12}{Add move shortcut}
% \begin{macro}{\upthehall}
% \changes{1.0.0}{2013/09/12}{Add move shortcut}
% \begin{macro}{\upthehall*}
% \changes{1.0.0}{2013/09/12}{Add move shortcut}
% Up and down the hall are often counted as a single move (sometimes with a
% `turn alone' or similar in between). You may want to use the
% \code{\textbackslash move} command to define your own versions of these
% commands, but just in case some shortcuts are provided anyways.
%    \begin{macrocode}
\newcommand*{\downthehall}{%
  \moveindex{Down the Hall}%
  \def\cc@dir{down}%
  \@ifstar\@walkthehallStar\@walkthehallNoStar%
}
\newcommand*{\upthehall}{%
  \moveindex{Up the Hall}%
  \def\cc@dir{up}%
  \@ifstar\@walkthehallStar\@walkthehallNoStar%
}
\newcommand*{\@walkthehallNoStar}[2][\unskip]{%
  \move[#2]{\expandafter\MakeUppercase\cc@dir\ the hall\ \ignorespaces#1\unskip}%
}
\newcommand*{\@walkthehallStar}[2][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[#2]{\ignorespaces#1\unskip\ \cc@dir\ the hall}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \section{Dance information}
%
% \begin{macro}{\dancetitle}
% \changes{1.0.0}{2013/09/11}{New macro}
% \begin{macro}{\danceauthor}
% \changes{1.0.0}{2013/09/11}{New macro}
% \begin{macro}{\danceform}
% \changes{1.0.0}{2013/09/11}{New macro}
% These macros give information about the current (or previous, if you're not in
% a dance environment) dance. They can be used for things like adding the dance
% name and number to the header in a book, referencing the dance author in
% footnotes, etc.
%    \begin{macrocode}
\newcommand*{\dancetitle}{}
\newcommand*{\danceauthor}{}
\newcommand*{\danceform}{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \section{Lists and Indices}
%
% \subsection{Lists}
%
% Just as many classes allow you to build a table of contents, or a list of
% figures, \pkg{contracard} allows you to create a list of dances.
%
% \begin{macro}{\listofdances}
% The list of dances is created by a call to \code{\textbackslash listofdance}
% by default, however, we define an alias: \code{\textbackslash listofdances}
% to prevent confusion.
%    \begin{macrocode}
\newlistof{dance}{lod}{\cfttoctitlefont\lodtitle}
\newcommand*{\listofdances}{\listofdance}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lodtitle}
% The title of the list of dances will be:
%    \begin{macrocode}
\newcommand*{\lodtitle}{List of Dances}
%    \end{macrocode}
% \end{macro}
%
% An \hyperlink{CC:LOD}{example list of dances} can be found at the beginning of
% this document.
%
% \subsection{Indices}
% \changes{1.0.0}{2013/09/08}{Added support for indices}
%
% \pkg{Contra Card} has the ability to produce several different indices that
% might be useful for your book or collection of dances. They are:
%
% \begin{center}
% \begin{tabular}{ l l }
%  Shortcut & Name \\
%  \hline
%  dbt & \hyperlink{CC:DBT}{Dances by Type} \\
%  dba & \hyperlink{CC:DBA}{Dances by Author} \\
%  mvp & \hyperlink{CC:MVP}{Moves by Page} \\
%  mvd & \hyperlink{CC:MVD}{Moves by Dance} \\
% \end{tabular}
% \end{center}
%
% An example of each type of index can be found at the end of this document.
%
% \begin{macro}{\enableidx}
% \changes{1.0.0}{2013/09/08}{New command}
% Indexing is not turned on by default in Contra Card. When you enable it, the
% \href{http://ctan.org/pkg/imakeidx}{\pkg{imakeidx}} package is loaded, and the
% indices are created. This means that \code{\textbackslash enableidx} should
% \emph{only} be called in the preamble.
%    \begin{macrocode}
\newcommand*{\enableidx}{%
  \PassOptionsToPackage{splitindex}{imakeidx}
  \RequirePackage{imakeidx}
  \cc@createindices
}%
\newcommand*{\cc@createindices}{%
  \makeindex[name=\cc@dbt,title=\dbtname]
  \makeindex[name=\cc@dba,title=\dbaname]
  \makeindex[name=\cc@mvp,title=\mvpname]
  \makeindex[name=\cc@mvd,title=\mvdname]
}%
%    \end{macrocode}
% Because we use the \code{splitindex} option, you'll need to run the
% \fname{splitindex} command against the index file. For instance, if your
% project is called \fname{root.tex} you'll want to run:
%
% \begin{quote}
% \code{\$ splitindex root}
% \end{quote}
% \end{macro}
%
% \begin{macro}{\pauseindexing}
% \changes{1.0.0}{2013/09/10}{New command}
% \begin{macro}{\resumeindexing}
% \changes{1.0.0}{2013/09/10}{New command}
% On occasion you might have a dance that you don't want to include in the index
% for some reason. When this happens, you can temporarily disable indexing (and
% later enable it again).
%    \begin{macrocode}
\newcommand*{\pauseindexing}{\def\cc@indexingpaused{}}
\newcommand*{\resumeindexing}{\let\cc@indexingpaused\undefined}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\cc@dbt}
% \changes{1.0.0}{2013/09/08}{New command}
% \begin{macro}{\cc@dba}
% \changes{1.0.0}{2013/09/08}{New command}
% \begin{macro}{\cc@mvp}
% \changes{1.0.0}{2013/09/08}{New command}
% \begin{macro}{\cc@mvd}
% \changes{1.0.0}{2013/09/08}{New command}
% Though you probably don't need to change this, the shortcut for each index can
% be changed by redefining the following commands (before you turn on indexing
% functionality):
%    \begin{macrocode}
\newcommand*{\cc@dbt}{dbt}
\newcommand*{\cc@dba}{dba}
\newcommand*{\cc@mvp}{mvp}
\newcommand*{\cc@mvd}{mvd}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\dbtname}
% \changes{1.0.0}{2013/09/08}{New command}
% \begin{macro}{\dbaname}
% \changes{1.0.0}{2013/09/08}{New command}
% \begin{macro}{\mvpname}
% \changes{1.0.0}{2013/09/08}{New command}
% \begin{macro}{\mvdname}
% \changes{1.0.0}{2013/09/08}{New command}
% The names of each index can also be changed by redefining these commands. This
% should also be done \emph{before} the indexing functionality is turned on.
% This means that if you're loading \pkg{Contra Card} with the \code{enableidx}
% package option, you shouldn't mess with these commands.
%    \begin{macrocode}
\newcommand*{\dbtname}{Dances by Type}
\newcommand*{\dbaname}{Dances by Author}
\newcommand*{\mvpname}{Moves by Page}
\newcommand*{\mvdname}{Moves by Dance}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\moveindex}
% \changes{1.0.0}{2013/09/08}{New command}
% \begin{macro}{\moveindex*}
% \changes{1.0.0}{2013/09/08}{New command}
% For any of the move shortcut macros, index entries are automatically added for
% the given move. However, for moves that you define yourself with the
% \code{\textbackslash move} command, you'll need to add index entries manually.
% This can be done with \code{\textbackslash moveindex}. This macro takes a
% single argument (the index entry to add) and should only be called from within
% the \code{contra} environment. The star version of the command also typesets
% the first argument (so you don't have to write it twice).
%    \begin{macrocode}
\newcommand*{\moveindex}{\@ifstar\moveindexStar\moveindexNoStar}
\newcommand*{\moveindexStar}[1]{%
  #1%
  \ifthenelse{\isundefined{\cc@indexingpaused}}{%
    \ifthenelse{\isundefined{\imki@wrindexentry}}{%
      \index{#1}%
    }{%
      \index[mvp]{#1}%
      \imki@wrindexentry{mvd}{#1}{\arabic{dance}}%
    }%
  }{}%
}
\newcommand*{\moveindexNoStar}[1]{%
  \ifthenelse{\isundefined{\cc@indexingpaused}}{%
    \ifthenelse{\isundefined{\imki@wrindexentry}}{%
      \index{#1}%
    }{%
      \index[mvp]{#1}%
      \imki@wrindexentry{mvd}{#1}{\arabic{dance}}%
    }%
  }{}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \section{Helper macros}
%
% The following macros are used by the \pkg{contracard} package to perform
% various tasks. Those that may also be of use to the contra dance writer have
% been left unhidden.
%
% \begin{macro}{\timesaround}
% \changes{1.0.0}{2013/09/05}{Split out ability to calculate times around}
% Sometimes it's useful to calculate the approximate number of times a given
% move can be done in a certain number of beats of music (eg.~the number of
% times around one can allemande in 6 beats). For this, the \code{\textbackslash
% timesaround} macro was created. It takes two arguments: the number of beats it
% takes to go one time around (eg.~4 for an allemande) and the total number of
% beats you have to work with. It spits out an integer, a fraction, or a mixed
% number and a word matching the regular expression:
% \regexp{/{[}1-9{]}*{[}\textonequarter\textonehalf%
% \textthreequarters{]}?(\textbackslash\ times?)?/}.

%
% For example: \code{\textbackslash timesaround\{4\}\{6\}} produces:
% ``\timesaround{4}{6}".
%    \begin{macrocode}
\newcounter{timesaround}
\newcounter{quartertimesaround}
\newcommand*{\timesaround}[2]{%
  \setcounter{timesaround}{\intcalcDiv{\intcalcNum{#2}}{\intcalcNum{#1}}}%
  \setcounter{quartertimesaround}{%
    \intcalcMod{\intcalcNum{#2}}{\intcalcNum{#1}}%
  }%
  \ifthenelse{\value{timesaround}>0}{\arabic{timesaround}}{}%
  \ifthenelse{\value{quartertimesaround}=1}{\textonequarter}{%
    \ifthenelse{\value{quartertimesaround}=2}{\textonehalf}{%
      \ifthenelse{\value{quartertimesaround}=3}{\textthreequarters}{}%
    }%
  }%
  \ifthenelse{%
    \value{timesaround}>1\OR%
    \(\value{timesaround}=1\AND\NOT\value{quartertimesaround}=0\)%
  }{\ times}{%
    \ifthenelse{\value{timesaround}=1}{\ time}{}%
  }%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\notes}
% \changes{1.0.0}{2013/09/10}{Make adding notes easier}
% This macro can be used to insert some nicely formatted notes at the end of
% your calling cards. Just use it in the \code{contra} environment right after
% your last move.
%    \begin{macrocode}
\newcommand*{\notes}[2][\cc@defaultnotesenv]{%
  \par\nopagebreak\vspace*{\prenotevspace}
  \begin{\cc@defaultnotesenv}
    \setlength{\baselineskip}{1.1em plus 0.1em minus 0.2em}
    \def\cc@notestitle{\textbf{\ignorespaces Notes\unskip}}%
    \setlength{\parindent}{0pt}%
    \setlength{\cc@partsepwidth}{\widthof{\footnotesize \cc@notestitle~}}%
    \setlength{\hangindent}{\cc@partsepwidth}%
    {\footnotesize \cc@notestitle~\ignorespaces#2\unskip}%
  \end{\cc@defaultnotesenv}
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\spelldosido}
% \changes{1.0.0}{2013/09/12}{Change how Do-si-do is spelled easily}
% \begin{macro}{\spellDosido}
% \changes{1.0.0}{2013/09/12}{Change how Do-si-do is spelled easily}
% \begin{macro}{\setdosidospelling}
% \changes{1.0.0}{2013/09/12}{Change how Do-si-do is spelled easily}
% These macros can be used for easily changing the spelling of `Do-si-do'
% anywhere a \code{\textbackslash dosido} command is found (and in the index).
% By default, we spell it the contra dance way (`Do-si-do'), however, this can
% easily be changed. For example, running \code{\textbackslash
% setdosidospelling\{dos-\textbackslash \`{}a-dos\}} will cause
% \code{\textbackslash spellDosido} to render: `Dos-\`a-dos' and
% \code{\textbackslash spelldosido} to render: `dos-\`a-dos'.
%    \begin{macrocode}
\def\spelldosido{do-si-do}
\def\spellDosido{Do-si-do}
\newcommand*{\setdosidospelling}[1]{%
  \protected@edef\spelldosido{\expandafter\MakeLowercase#1}
  \protected@edef\spellDosido{\expandafter\MakeUppercase#1}
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\cc@checkphrasestart}
% This macro is used by various parts of contra card to reset the dance phrase
% and part at the appropriate time. You should probably just move on and leave
% it alone.
%    \begin{macrocode}
\newcommand*{\cc@checkphrasestart}{%
  \ifthenelse{\value{phrasecount}=\value{dancephraselength}}{%
    \newdancephrase%
  }{%
    \ifthenelse{\(\value{partcount}=\value{dancepartlength}\)}{%
     \newdancepart%
    }{}%
  }%
}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\ProcessOptions\relax
%</contracard-pkg>
%    \end{macrocode}
%
% \clearpage
% \phantomsection
% \part{The \pkg{contracard} class}
%
%    \begin{macrocode}
%<*contracard-cls>
%    \end{macrocode}
%
% The Contra Card project also provides a class (\fname{contracard.cls}) which
% acts as a convenience wrapper around the core functionality provided by the
% package. This is useful for generating calling cards, and saves you the
% trouble of looking up standard card sizes and figuring out margins and where
% to put headings and the like.
%
% \phantomsection
% \hypertarget{CCCLASS:OPTIONS}{}
% \subsection{Options}
%
% \begin{macro}{small}
% \begin{macro}{medium}
% \begin{macro}{large}
% \begin{macro}{a7paper}
% \begin{macro}{draft}
% \changes{1.0.0}{2013/09/11}{Pass option through to \code{article} class}
% The class can be loaded with any of the following options. The various size
% options are summarized in the table below. Any unrecognized options are passed
% to the \pkg{contracard} package.
%
% \begin{center}
% \begin{tabular}{ l l l }
%  Option & Size (mm) & Size (in) \\
%  \hline
%  \code{small}   & 127.0 $\times$ 76.2  & 5.0 $\times$ 3.0 \\
%  \code{medium}  & 152.4 $\times$ 101.6 & 6.0 $\times$ 4.0 \\
%  \code{large}   & 203.2 $\times$ 27.0  & 8.0 $\times$ 5.0 \\
%  \code{a7paper} & 105.0 $\times$ 74.0  & 4.1 $\times$ 2.9 \\
% \end{tabular}
% \end{center}
%    \begin{macrocode}
\AtBeginDocument{\large}
\PassOptionsToPackage{%
  margin=0.5in,top=0.75in,paperwidth=6in,paperheight=4in%
}{geometry}%
\DeclareOption{small}{%
  \AtBeginDocument{%
    \titleformat{\section}{\normalsize\bfseries}{\thesection}{1em}{}%
    \titleformat{\subsection}{\normalsize}{\thesection}{1em}{}%
  }
  \PassOptionsToPackage{%
    margin=0.25in,top=0.75in,paperwidth=5in,paperheight=3in%
  }{geometry}%
}
\DeclareOption{medium}{%
  \AtBeginDocument{\large}
  \PassOptionsToPackage{%
    margin=0.5in,top=0.75in,paperwidth=6in,paperheight=4in%
  }{geometry}%
}
\DeclareOption{large}{%
  \AtBeginDocument{\Large}
  \PassOptionsToPackage{%
    margin=0.75in,top=1in,paperwidth=8in,paperheight=5in%
  }{geometry}%
}
\DeclareOption{a7paper}{%
  \AtBeginDocument{%
    \titleformat{\section}{\normalsize\bfseries}{\thesection}{1em}{}%
    \titleformat{\subsection}{\normalsize}{\thesection}{1em}{}%
  }
  \PassOptionsToPackage{%
    margin=5mm,top=15mm,paperwidth=105mm,paperheight=74mm%
  }{geometry}%
}
\DeclareOption{draft}{%
  \PassOptionsToClass{draft}{article}%
}
\DeclareOption*{%
  \PassOptionsToPackage{\CurrentOption}{contracard}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsection{Environment setup}
%
% The \pkg{contracard} class does a little extra work to turn off headers, and
% prevent page numbering:
%
%    \begin{macrocode}
\AtBeginDocument{\pagestyle{empty}}
\AtBeginDocument{\pagenumbering{gobble}}
%    \end{macrocode}
% It also defines a command \code{\textbackslash @ccisclass} to let the
% \pkg{contracard} package know that it was called via the class:
%    \begin{macrocode}
\newcommand*{\@ccisclass}{}
\ProcessOptions\relax
%</contracard-cls>
%    \end{macrocode}
%
% \cleardoublepage
% \begin{appendices}
% \section{On Notation}
% \label{appendix:notation}
%
% \begin{macro}{\gypsy}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% \begin{macro}{\gypsy*}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% \begin{macro}{\gypsyleft}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% \begin{macro}{\gypsyleft*}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% \begin{macro}{\gypsyright}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% \begin{macro}{\gypsyright*}
% \changes{1.0.0}{2013/09/06}{Add move shortcut}
% In some circles (pun intended) the move ``walk around" or ``right/left
% shoulder round" (also ``spiral", ``gyre", ``eyes", etc.) is called a ``gypsy".
% This is considered an ethnic slur by some groups of the Romani people.
% While the contra term is not likely to have been derived from the slur, I see
% no reason not to use an alternative.
% In version 2 of this document---and in calling cards generated with this
% package---I have chosen to use the term ``walk around" when no direction needs
% to be specified, or ``right/left shoulder round" when it does.
% This avoids creating an uncomfortable situation for a dancer hearing a word
% that to them may be associated with hostility, and a lifetime of persecution.
% It seems to me that providing a safe and welcoming dance environment is worth
% the trivial inconvenience of having to learn a new move name.
%
% The commands listed in the margin have been renamed, for their alternatives
% see \texttt{\textbackslash walkaround} and its variants.
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \section{Deprecated macros}
% \label{appendix:deprecated}
%
% \begin{macro}{\longpetronella}
% \changes{1.0.0}{2013/09/08}{Add move shortcut}
% \changes{2.0.0}{2018/07/25}{Remove move}
% \begin{macro}{\longpetronella*}
% \changes{1.0.0}{2013/09/08}{Add move shortcut}
% \changes{2.0.0}{2018/07/25}{Remove move}
% \begin{macro}{\longpetronellanella}
% \changes{1.1.0}{2018/07/21}{Add nella-nella petronella variants}
% \changes{2.0.0}{2019/02/24}{Remove move}
% \begin{macro}{\rollawayhalfsashay}
% \changes{1.0.0}{2013/09/10}{Add move shortcut}
% \changes{2.0.0}{2018/07/25}{Renamed to ``\texttt{\textbackslash rollawaysashay}''}
% \begin{macro}{\rollawayhalfsashay*}
% \changes{1.0.0}{2013/09/10}{Add move shortcut}
% \changes{2.0.0}{2018/07/25}{Renamed to ``\texttt{\textbackslash rollawaysashay*}''}
% \begin{macro}{\rawhs}
% \changes{1.0.0}{2013/09/10}{Add move shortcut}
% \changes{2.0.0}{2018/07/25}{Remove move}
% \begin{macro}{\rawhs*}
% \changes{1.0.0}{2013/09/10}{Add move shortcut}
% \changes{2.0.0}{2018/07/25}{Remove move}
% These macros (as well as the ones mentioned in appendix
% \ref{appendix:notation}) have been removed from the package, resulting in a
% major version bump.
% If you were using any of these macros in your documents, you may wish to
% continue using an older version of this package or update your documents
% before upgrading.
% For information about what version each macro was removed in see the change
% log.
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \section{Upgrading from 1.x}
%
% Aside from removing deprecated macros, (see appendix
% \ref{appendix:deprecated}), you will also want to search your dances for the
% text \code{\textbackslash balanceand} and decrement the following move by 4
% counts.
% Previously, the \code{\textbackslash balanceand} macros took up 0 logical
% counts of music, but in version 2.0 it adds 4 counts to the next move.
% Several new move shortcuts were also added in version 2.0 of this package
% which may be able to replace uses of the generic \code{\textbackslash move}
% macro in your dances.
% For a full list, see the change history at the end of this document.
%
% \end{appendices}
%
% \bookmarksetup{startatroot}
% \addtocontents{toc}{\bigskip}
% \clearpage
% \setcounter{IndexColumns}{2}
% \phantomsection
% \addcontentsline{toc}{section}{Index}
% \PrintIndex
% \clearpage
% \phantomsection
% \addcontentsline{toc}{section}{\dbtname}
% \hypertarget{CC:DBT}{}
% \printindex[\cc@dbt]
% \clearpage
% \phantomsection
% \addcontentsline{toc}{section}{\dbaname}
% \hypertarget{CC:DBA}{}
% \printindex[\cc@dba]
% \clearpage
% \phantomsection
% \addcontentsline{toc}{section}{\mvpname}
% \hypertarget{CC:MVP}{}
% \printindex[\cc@mvp]
% \clearpage
% \phantomsection
% \addcontentsline{toc}{section}{\mvdname}
% \hypertarget{CC:MVD}{}
% \printindex[\cc@mvd]
%
% \makeatletter
%   \renewenvironment{theglossary}{%
%   \glossary@prologue
%   \setlength\emergencystretch{5em}
%   \GlossaryParms \let\item\@idxitem \ignorespaces}{}
% \makeatother
% \clearpage
% \phantomsection
% \addcontentsline{toc}{section}{Change History}
% \PrintChanges
% \Finale
%
% \iffalse
%\fi
\endinput