% \iffalse
%<*internal>
\iffalse
%</internal>
%<*readme>
# Contra Card

A LaTeX package for typesetting traditional contra and square dances, and a
class which generates calling cards for the same.

## Download

Development of this package occurs primarily on
[GitHub](https://github.com/SamWhited/contracard). Issues and pull requests
should be submitted there.

The current [release
version](http://ctan.org/tex-archive/macros/latex/contrib/contracard) of
**Contra Card** and associated
[documentation](http://mirrors.ctan.org/macros/latex/contrib/contracard/contracard.pdf)
[PDF] is available from [CTAN](http://ctan.org/pkg/contracard) or
[GitHub](https://github.com/SamWhited/contracard/releases).

## License

Copyright 2012 Samuel Whited

This file may be distributed and/or modified under the conditions of the LaTeX
Project Public License, either version 1.3c of this license or (at your option)
any later version. The latest version of this license can be found at:

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.

This work has the LPPL maintenance status `maintained'.

- Author:     Sam Whited
- Maintainer: Sam Whited
- Website:    https://samwhited.com
- Contact:    sam@samwhited.com
- Public key: 0xEC2C9934

This work consists of this file contracard.dtx and the derived files
`contracard.sty`, `contracard.cls`, `contracard.pdf`, `README.md`, and `README`.
%</readme>
%<*internal>
\fi
\begingroup
\input docstrip.tex
\keepsilent
\usedir{tex/latex/contracard}
\preamble

  Copyright 2012 Samuel Whited

  This file may be distributed and/or modified under the
  conditions of the LaTeX Project Public License, either
  version 1.3c of this license or (at your option) any later
  version. The latest version of this license is in:

  http://www.latex-project.org/lppl.txt

  and version 1.3c or later is part of all distributions of
  LaTeX version 2008/05/04 or later.

  For the maintenance status and other document metadata,
  see the end of this document.

\endpreamble
\postamble

  ___________
  This work has the LPPL maintenance status `maintained'.

  Author:     Sam Whited
  Maintainer: Sam Whited
  Website:    https://samwhited.com
  Contact:    sam@samwhited.com
  Public key: 0xEC2C9934

  This work consists of this file contracard.dtx
            and the derived files contracard.sty
                              and contracard.cls
                              and contracard.pdf
                              and README.md
                              and README

\endpostamble
\askforoverwritefalse

\generate{\file{contracard.sty}{\from{contracard.dtx}{contracard-pkg}}}
\generate{\file{contracard.cls}{\from{contracard.dtx}{contracard-cls}}}
\nopreamble\nopostamble
\generate{\file{README.md}{\from{contracard.dtx}{readme}}}

\obeyspaces
\Msg{****************************************************}
\Msg{*                                                  *}
\Msg{* To finish the installation you have to move the  *}
\Msg{* following file into a directory searched by TeX: *}
\Msg{*                                                  *}
\Msg{* contracard.sty                                   *}
\Msg{* contracard.cls                                   *}
\Msg{*                                                  *}
\Msg{****************************************************}

\endgroup
%</internal>
%
%<*driver>
\ProvidesFile{contracard.dtx}
%</driver>
%
%<*contracard-pkg>
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{contracard}[2013/09/16 Package for typesetting called dances]
%</contracard-pkg>
%<*contracard-cls>
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{contracard}[2013/09/16 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}

\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}\\*
%   \texttt{0xEC2C9934}
% }
% \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://github.com/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.
%
% \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} Before building the \pkg{contracard} package you
% should verify that the following dependencies 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\longpetronella
%   \balanceand\longpetronella
%   \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}
%   \gypsy[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\longpetronella
%   \balanceand\move[8]{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 gypsy left 1 time to new
%   neighbors\moveindex{Balance}\moveindex{Gypsy}\moveindex{Gypsy Left}}
%   \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}
% \setlength{\phrasevspace}{0em}
% \renewcommand*{\partdelimiter}{:}
% \begin{contra}{Untitled Blues \textnumero\ 1}{Seth Tepfer}{Duple minor im.}
%   \gypsy*[Neighbor]{8}
%   \gypsy*[Ladies]{8}
%   \newdancephrase
%   \balanceand*[Partner]\swing{16}
%   \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}
% \setlength{\phrasevspace}{0em}
% \renewcommand*{\partdelimiter}{:}
% \begin{contra}{Untitled Blues \textnumero\ 1}{\href{http://www.dancerhapsody.com/calling/dances.html}{Seth Tepfer}}{Duple minor im.}
%   \gypsy*[Neighbor]{8}
%   \gypsy*[Ladies]{8}
%   \newdancephrase
%   \balanceand*[Partner]\swing{16}
%   \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}
% \setlength{\phrasevspace}{0em}
% \renewcommand*{\partdelimiter}{:}
% \setcounter{dancephraselength}{16}
% \begin{contra}{Untitled Blues \textnumero\ 2}{Seth Tepfer}{Duple minor im.}
%   \gypsy*[Neighbor]{8}
%   \move[8]{Gents allemande\moveindex{Allemande} left 1\textonehalf}
%   \balanceand*[Partner]\swing{16}
%   \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}
% \setlength{\phrasevspace}{0em}
% \renewcommand*{\partdelimiter}{:}
% \setcounter{dancephraselength}{16}
% \begin{contra}{Untitled Blues \textnumero\ 2}{\href{http://www.dancerhapsody.com/calling/dances.html}{Seth Tepfer}}{Duple minor im.}
%   \gypsy*[Neighbor]{8}
%   \move[8]{Gents allemande\moveindex{Allemande} left 1\textonehalf}
%   \balanceand*[Partner]\swing{16}
%   \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*{\@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\ %
  }{}%
  \addtocounter{dancecount}{#1}%
  \addtocounter{phrasecount}{#1}%
  \addtocounter{partcount}{#1}%
  \addtocounter{phrasemovenum}{1}%
  \addtocounter{partmovenum}{1}%
  \addtocounter{halfpartmovenum}{1}%
  \addtocounter{dancemovenum}{1}%
  \ifthenelse{\isundefined{\@showcountbefore}\OR\(#1=0\)}{%
    \relax%
  }{\cc@countleftbracket\ignorespaces#1\unskip\cc@countrightbracket~}%
  \ignorespaces#2\unskip%
  \ifthenelse{\isundefined{\@showcountafter}\OR\(#1=0\)}{%
    \relax%
  }{~\cc@countleftbracket\ignorespaces#1\unskip\cc@countrightbracket}%
  \ifthenelse{\NOT\(#1=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%
  }{}%
}
%    \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}
% \begin{macro}{\balanceand*}
% \changes{1.0.0}{2013/09/05}{Add move shortcut}
% 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 unless you use the
% \code{\textbackslash balanceand} version of the command which takes up 0
% logical counts.  This way you can follow it up with another command
% (eg.~\code{\textbackslash balanceand*[Partner]\textbackslash swing}).
%    \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][]{%
  \move*[0]{Balance and \ignorespaces#1\unskip\ \ \ignorespaces}%
}
\newcommand*{\@balanceandStar}[1][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move*[0]{\ignorespaces#1\unskip\ balance and\ \ \ignorespaces}%
}
%    \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}{\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}
% Several different macros exist for creating Gypsy's; while you can create
% right and left gypsy's with the normal \code{\textbackslash gypsy} macro, the
% \code{\textbackslash gypsyleft} and \code{\textbackslash gypsyright} macros
% also index the move under the given direction.
%    \begin{macrocode}
\newcommand*{\gypsy}{%
  \moveindex{Gypsy}%
  \@ifstar\@gypsyStar\@gypsyNoStar%
}
\newcommand*{\gypsyright}{%
  \moveindex{Gypsy}%
  \moveindex{Gypsy Right}%
  \def\cc@thedir{right}%
  \@ifstar\@gypsyDirStar\@gypsyDirNoStar%
}
\newcommand*{\gypsyleft}{%
  \moveindex{Gypsy}%
  \moveindex{Gypsy Left}%
  \def\cc@thedir{left}%
  \@ifstar\@gypsyDirStar\@gypsyDirNoStar%
}
\newcommand*{\@gypsyNoStar}[2][\unskip]{%
  \move[#2]{Gypsy \ignorespaces#1\unskip}
}
\newcommand*{\@gypsyStar}[2][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[#2]{\ignorespaces#1\unskip\ gypsy}
}
\newcommand*{\@gypsyDirNoStar}[2][\unskip]{%
  \move[#2]{Gypsy \cc@thedir\ \ignorespaces#1\unskip}
}
\newcommand*{\@gypsyDirStar}[2][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[#2]{\ignorespaces#1\unskip\ \cc@thedir\ gypsy}
}
%    \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}
% 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 for the purpose of these shortcut macros.
%    \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}
}
%    \end{macrocode}
% \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{Gypsy star \textthreequarters}\moveindex{Gypsy Star}
%   \move[16]{Gypsy and swing partner}\moveindex{Gypsy}\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}{\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}{\longpetronella}
% \changes{1.0.0}{2013/09/08}{Add move shortcut}
% \begin{macro}{\longpetronella*}
% \changes{1.0.0}{2013/09/08}{Add move shortcut}
% 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. Petronella's themselves take 4 beats, but they
% are normally prefixed by a balance. Since the \code{\textbackslash balanceand}
% macro takes up zero logical beats, we also provide \code{\textbackslash
% longpetronella} which takes up the full 8 counts. This way you can write
% \code{\textbackslash balanceand\textbackslash longpetronella} and the timing
% will be correct.
%    \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*{\longpetronella}{%
  \moveindex{Petronella}%
  \@ifstar\@longpetronellaStar\@longpetronellaNoStar%
}
\newcommand*{\@longpetronellaNoStar}[1][\unskip]{%
  \move[8]{Petronella \ignorespaces#1\unskip}%
}
\newcommand*{\@longpetronellaStar}[1][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[8]{\ignorespaces#1\unskip\ petronella}%
}
%    \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}
% \begin{macro}{\rollaway*}
% \changes{1.0.0}{2013/09/10}{Add move shortcut}
% \begin{macro}{\rollawayhalfsashay}
% \changes{1.0.0}{2013/09/10}{Add move shortcut}
% \begin{macro}{\rollawayhalfsashay*}
% \changes{1.0.0}{2013/09/10}{Add move shortcut}
% \begin{macro}{\rawhs}
% \changes{1.0.0}{2013/09/10}{Add move shortcut}
% \begin{macro}{\rawhs*}
% \changes{1.0.0}{2013/09/10}{Add move shortcut}
% ``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 rollawaywithahalfsashay} macro (and its shorter alias:
% \code{\textbackslash rawhs}) 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 rawhs*{[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*{\rawhs}{\rollawayhalfsashay}
\newcommand*{\rollawayhalfsashay}{%
  \moveindex{Roll Away}%
  \moveindex{Roll Away with a Half Sashay}%
  \moveindex{Half Sashay}%
  \@ifstar\@rawhsStar\@rawhsNoStar%
}
\newcommand*{\@rollawayNoStar}[1][\unskip]{%
  \move[4]{Roll away \ignorespaces#1\unskip}%
}
\newcommand*{\@rollawayStar}[1][%
  \expandafter\expandafter\expandafter\MakeUppercase\@gobbletwo]{%
  \move[4]{\ignorespaces#1\unskip\ roll away}%
}
\newcommand*{\@rawhsNoStar}[1][\unskip]{%
  \move[4]{Roll \ignorespaces#1\unskip\ away with a half sashay}%
}
\newcommand*{\@rawhsStar}[2][\unskip]{%
  \move[4]{\ignorespaces#2\unskip\ roll \ignorespaces#1\unskip\ away with a half sashay}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \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 rawhs} 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}
\newcommand*{\timesaround}[2]{%
  \newcounter{timesaround}%
  \setcounter{timesaround}{\intcalcDiv{\intcalcNum{#2}}{\intcalcNum{#1}}}%
  \newcounter{quartertimesaround}%
  \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}
%
% \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
