Revision 7f9f4408196eaffbe2e3a58f27d48ab9d311140a authored by Niols on 25 November 2023, 12:25:54 UTC, committed by Niols on 25 November 2023, 12:25:54 UTC
1 parent 3cc4d60
Raw File
preamble.tex
\documentclass[a5paper, 11pt, article]{memoir}
\usepackage{geometry}
\geometry{
  a5paper,
  top=20.013mm,
  bottom=9.66mm,
  inner=13.912mm,
  outer=10.36mm,
  includefoot,
  foot=1.3em,
%  showframe, %% shows frame around pages
}

\usepackage{xltxtra,fontspec,xunicode}
\defaultfontfeatures{Scale=MatchLowercase}
\setromanfont[Numbers=Uppercase]{Source Sans Pro}

\usepackage[hidelinks]{hyperref}
\usepackage{array}
\usepackage{xcolor}
\usepackage{xifthen}
\usepackage{fancyhdr}
\usepackage{xparse}
\usepackage{tikz,tikzpagenodes}
\usetikzlibrary{shapes,arrows,shadows,backgrounds,positioning,trees,calc,fit}

\usepackage{subcaption}
\usepackage{pdfpages}

%% No space between items in itemize; reduce margin before.
\usepackage{enumitem}
\setlist[itemize]{noitemsep, topsep=-0.5em}

\fancyhf{}
\renewcommand\headrulewidth{0pt}
\renewcommand\footrulewidth{0pt}
\fancyfoot[RO,LE]{\thepage}

%% Define a new kind of entry, 'dance', in the table of contents.
\makeatletter
\newcommand\l@dance[2]{%
  #1\makebox[\@pnumwidth][r]{#2}\\[.4em]
}
\newcommand\l@tune[2]{%
  #1\\[.6em]%
}
\makeatother

%% Table of dances. Just read the content of the .tod file.
\makeatletter
\def\tableofdances{%
  \@starttoc{tod}%
}
\def\tableoftunes{%
  \@starttoc{tot}%
}
\makeatother

%% The book will keep a notion of current dance, for which we know a certain
%% number of things. Each time we start defining a dance, we want to clear the
%% information we knew so far.
\newcommand\clearcurrentdance{%
  \gdef\currentname{}%
  \gdef\currentkind{}%
  \gdef\currentdeviser{}%
  \gdef\currenttune{}%
  \gdef\currentcomposer{}%
}

\newcommand\tunetotline[3]{%
  \mbox{%
    \parbox[c]{.35\linewidth}{\raggedright #1}%
    %\makebox[.05\linewidth]{~}%
    \parbox[c]{.35\linewidth}{\fontsize{10pt}{11pt}\selectfont\raggedright #2}%
    %\makebox[.05\linewidth]{~}%
    \makebox[.3\linewidth][r]{\raggedleft #3}%
  }%
}

%% Since the dance cans span multiple pages and we only create the .tod entry at
%% the end of a dance (when we have gathered enough information), we need a way
%% to create a contents line not with \thepage but with something else.
\makeatletter
\def\addcontentslinewithpage#1#2#3#4{
  \addtocontents{#1}{%
    \protect\contentsline{#2}{#4}{#3}{}%
    \protected@file@percent%
  }%
}
\makeatother

%% Create a .tod entry for the current dance.
\newcommand\addcurrentdancetotodandtot{%
  \addcontentslinewithpage{tod}{dance}{\dancestartpage}{%
    \currentname%
    \hfill%
    \currentdeviser%
    \qquad%
    \makebox[3.6em][r]{\currentkind}%
    \quad%
  }
  \ifthenelse{\equal{\currenttune}{}}{%
    \addcontentslinewithpage{tot}{tune}{\dancestartpage}{%
      \tunetotline{\currentname}{~}{\currentcomposer}}%
  }{%
    \addcontentslinewithpage{tot}{tune}{\dancestartpage}{%
      \tunetotline{\currenttune}{Dance: \currentname}{\currentcomposer}}%
  }%
}

\newlength\phraseparskip

\DeclareDocumentEnvironment{text}{O{1} O{1} m}{%
  \vspace*{4em}%
  \makebox[\linewidth][l]{\hspace{2em}\fontsize{28.8pt}{31.7pt}\selectfont #3}\\%
  \makebox[\linewidth][l]{\hspace{2.2em}\fontsize{15.3pt}{16.8pt}\selectfont \textbf{#1}}%
  \vspace{#2em}\vspace{#2em}\par%
}{}

\DeclareDocumentEnvironment{textnomargin}{O{1} m}{%
  \makebox[\linewidth][l]{\hspace{2em}\fontsize{28.8pt}{31.7pt}\selectfont #2}%
  \vspace{#1em}\vspace{#1em}\vspace{#1em}\par%
}{}

\newenvironment{dance}[4][1.48]{%
  \clearcurrentdance%
  \setcounter{figure}{0}%
  \phantomsection%
  \xdef\dancestartpage{\thepage}%
  \setlength\phraseparskip\parskip%
  \par%
  %
  \makebox[\linewidth]{\centering\fontsize{22pt}{24.2pt}\selectfont #2}%
  \vspace{1.257em}\\
  \parbox[t][3em]{\linewidth}{\centering #4}%
  \vspace{#1em}\par%
  %
  \gdef\currentname{#2}%
  \gdef\currentkind{#3}%
}{%
  \addcurrentdancetotodandtot%
}

\newcommand\chord[1]{%
  \textit{#1}%
}

%% This macro typesets the deviser and defines the current deviser. An optional
%% parameter can be given for the short name of the deviser/s in the table of
%% contents.
\newcommand\deviser[2][]{%
  #2%
  \ifthenelse{\isempty{#1}}
    {\gdef\currentdeviser{#2}}
    {\gdef\currentdeviser{#1}}%
}%

\newcommand\composer[2][]{%
  \ifthenelse{\equal{#2}{\currentdeviser}}
    {the deviser}
    {#2}%
  \ifthenelse{\isempty{#1}}
    {\gdef\currentcomposer{#2}}
    {\gdef\currentcomposer{#1}}%
}

\newcommand\devisercomposer[1]{%
  #1%
  \gdef\currentdeviser{#1}%
  \gdef\currentcomposer{#1}%
}

\newcommand\tunetext[1]{\textit{#1}}

\newcommand\tune[2][]{%
  \tunetext{#2}%
  \ifthenelse{\isempty{#1}}
    {\gdef\currenttune{#2}}
    {\gdef\currenttune{#1}}%
}

\newcommand\danceline[2]{%
  \par%
  \parbox[t]{.065\linewidth}{#1}%
  \parbox[t]{.035\linewidth}{~}%
  \parbox[t]{.90\linewidth}{%
    \setlength\parskip\phraseparskip%
    \raggedright%
    #2%
  }%
}

\newcommand\phrase[3]{%
  \danceline{%
    \parbox[t]{.3846\linewidth}{\raggedleft #1}%
    \parbox[t]{.2308\linewidth}{\centering -}%
    \parbox[t]{.3846\linewidth}{\raggedright #2}%
  }{#3}%
}

\newcommand\repeathavingpassed{%
  Repeat, having passed a couple.%
}
\newcommand\repeatfromnewpos{%
  Repeat from new positions.%
}

\newcommand\etal{\textit{et al.}}

\newcommand\hidepagenumbers{\pagestyle{empty}}
\newcommand\startcountingpages{\setcounter{page}{1}}
\newcommand\showpagenumbers{\pagestyle{fancy}}

\newcommand\includedance[1]{\input{dances/vol\volumenumber/#1}\newpage}
\newcommand\includediagram[1]{{\centering\includegraphics[width=.8\linewidth]{diagrams/vol\volumenumber/#1}\\[2em]}}

\setlength\parskip{1em}
\setlength\parindent{0pt}

%% Inter line space, taken from vol1.
\linespread{.8}

\newcommand\boxedpage[1]{%
  \tikz[remember picture,overlay]{
    \draw [#1,line width=2pt]
      (current page.south west)
      rectangle
      (current page.north east);
  }%
}

\newif\ifcompanion
\companionfalse

%% RSCDS Standard Terminology say figures must be called 'Fig.'.
\renewcommand\figurename{Fig.}
\renewcommand\figureautorefname{Fig.}

\usepackage{wrapfig}
back to top