-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmacros.tex
120 lines (99 loc) · 3.17 KB
/
macros.tex
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
\newcommand{\songTitle}[1]{
{\Huge\sffamily\bfseries\MakeUppercase{#1}}
}
\newcommand{\songAuthor}[1]{
{\LARGE\sffamily\slshape #1}
}
\newenvironment{song}[3]{
\clearpage
\centering
\phantomsection\addcontentsline{toc}{section}{\noindent{#1}}%
\songTitle{#1}\\[8pt]
\songAuthor{#2}\\
\begin{guitar}
\leftskip=#3
\Large
}{
\end{guitar}
}
\newcommand\capo[1]{%
\sbox{\mybox}{\slshape Capo #1}%
\vskip-40pt\hfill\usebox{\mybox}}
\newcommand\bFont{\LARGE\bfseries}
\renewcommand{\verse}[1]{%
\sbox{\mybox}{\LARGE\bfseries #1.}%
\hskip -\wd\mybox%
\hskip -5pt%
\usebox{\mybox}%
\hskip 5pt%
}
\newsavebox\mybox
\newcommand{\chorus}{%
\sbox{\mybox}{\LARGE\bfseries R:}%
\hskip -\wd\mybox%
\hskip -5pt%
\usebox{\mybox}%
\hskip 5pt%
}
\newcommand{\nchorus}[1]{%
\sbox{\mybox}{\LARGE\bfseries R#1:}%
\hskip -\wd\mybox%
\hskip -5pt%
\usebox{\mybox}%
\hskip 5pt%
}
\newcommand{\rec}[1]{%
\sbox{\mybox}{\LARGE\bfseries\itshape Rec.}%
\hskip -\wd\mybox%
\hskip -5pt%
\usebox{\mybox}%
\hskip 5pt%
{\itshape #1}
}
% Right repetition
\newcommand{\rl}{%
\raisebox{-.4ex}{\rule{.3ex}{2.5ex}\,\rule{.1ex}{2.5ex}}%
\raisebox{.2ex}{:}\hskip 3pt}
% Left repetition with optional \times
\newcommand{\rr}[1]{%
\hskip 3pt\raisebox{.2ex}{:}%
\raisebox{-.4ex}{\rule{.1ex}{2.5ex}\,\rule{.3ex}{2.5ex}}%
\ifthenelse{\isempty{#1}}{}{\ #1$\times$}}
\newcommand{\rep}[1]{#1$\times$}
\newcommand{\repchor}{{\Large\bfseries R:}}
% Set chords font
\renewcommand{\guitarPreAccord}{\sffamily\bfseries\Large}
% Customize end of line behavior
\renewcommand\guitarEndLine{\par\leavevmode\setstretch{1}}
\renewcommand\guitarEndPar{\par\setstretch{1}\bigskip\leavevmode}
\renewcommand\guitarEndDoublePar{\par\setstretch{1}\bigskip\leavevmode}
\makeatletter
% Hack: word stretching with a dash
\def\myrulefill{\hskip 1pt\xrfill[.5ex]{.4pt}\hskip 1pt}
\renewcommand\guitarPutMerge{\gtr@distMerge\myrulefill}
% Hack: set line spacing when there are chords and set how much the chords are raised
\def\setChordsLineStretch{\setstretch{1.75}}
\def\setRaiseHeigth{13pt}
\renewcommand\guitarPut[1]{\setChordsLineStretch\setbox0\hbox{\strut#1}\leavevmode
\raise\setRaiseHeigth\hbox to 0pt{\hbox to\wd0{\guitarPreAccord
\hfill\guitarAccord\hfill\hss}\hss}#1}
\renewcommand\guitarPutOnSpace{\setChordsLineStretch\leavevmode\raise\setRaiseHeigth
\hbox{\guitarPreAccord\guitarAccord}}
\renewcommand\gtr@distMerge[2]{\setChordsLineStretch\setbox\guitarBox\hbox{\strut#2}%
\setbox0\hbox{\guitarPreAccord\guitarAccord}\leavevmode
\guitarDim=\wd0\relax\guitarCalcDim
\ifdim\wd\guitarBox<\guitarDim% Accord is too large:
\hbox to 0pt{\raise\setRaiseHeigth\hbox{\copy0}\hss}%
\hbox to\guitarDim{\box\guitarBox#1}%
\let\guitarAccord\toolboxEmpty%now used as a temporary variable.
\else
\hbox to 0pt{\raise\setRaiseHeigth
\hbox to\wd\guitarBox{\hfil\box0\hfil}\hss}%
\def\guitarAccord{#2}%
\fi\guitarAccord}
% Hack: makes \leftskip work in guitar environment
\renewcommand\guitarCrOnHook{\begingroup
\parindent 0pt\leavevmode\nobreak\hskip-\leftskip\relax
\finalhyphendemerits=0\everypar{\nobreak}\sloppy\relax
\linepenalty=50\relax\parskip0pt\relax}
\makeatother