2 %% include file for LilyPond
4 %% this file defines various macros to accomodate lilypond output
7 \def\ifundefined#1{\expandafter\ifx\csname#1\endcsname\relax}
9 % skip if included already
10 \def\SkipLilydefs{\endinput}
11 \ifundefined{EndLilyPondOutput}
12 \def\EndLilyPondOutput{\csname bye\endcsname}
17 \ifundefined{mudelacopyright}
18 \def\mudelacopyright{\copyright\ \number\year}
20 \ifundefined{LilyIdString}
21 \def\LilyIdString{Lily was here}
24 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
25 % macros to shorten other definitions
26 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
27 \def\musicdef#1#2{\def#1{\musicchar{#2}}}
28 \def\musicchar#1{\musicfnt\char#1}
29 \def\rationalmultiply#1*#2/#3{\multiply #1 by #2 \divide #1 by #3}
32 \def\maccentraise#1#2{\dimen0=\noteheight
33 \rationalmultiply\dimen0*#2%
34 \raise\dimen0\hbox{#1}}
35 \def\maccentdef#1#2#3{\def#1{\maccentraise{\musicchar{#2}}{#3}}}
36 \def\vertcenter#1{\vbox to 0pt{\vss #1\vss}}
38 \def\musicmathdef#1#2{\def#1{\musicmathchar{#2}}}
39 \def\musicmathchar#1{\musicmathfont\char#1}
41 \def\topalign#1{\vbox to 0pt{#1\vss}}
42 \def\botalign#1{\vbox to 0pt{\vss #1}}
44 \def\centeralign#1{\hbox to 0pt{\hss#1\hss}}
45 \def\leftalign#1{\hbox to 0pt{#1\hss}}
46 \def\rightalign#1{\hbox to 0pt{\hss#1}}
49 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
53 \newdimen\interlinedist
58 \newdimen\staffrulethickness
59 \newdimen\interstaffrule
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63 % set fonts and primary dimensions
70 \font\textmusic=cmmi12
74 \def\musixsixteendefs{
79 \font\textmusic=cmmi10
83 \def\textsharp{\raise.4ex\hbox{\textmusic\char"5D}}
84 \def\textnatural{\raise.4ex\hbox{\textmusic\char"5C}}
85 \def\textflat{\raise.2ex\hbox{\mus\char"5B}}
90 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
94 \interlinedist=\fontdimen5\musicfnt
95 \smallspace=.3\interlinedist
96 \interstaffrule=\balkheight
97 \divide\interstaffrule by 4
99 % [D.K.Roush & J.S.Gourlay] say this should be 0.072
101 \staffrulethickness=0.1\interlinedist
110 \musicmathdef\cup{91} % \cup
111 \musicmathdef\wedge{94} % \wedge
112 \musicmathdef\striepke{0} % heu?
114 %% custom characters --- this should go: add to (meta!) font
115 % \def\myheel{\kern-.5ex\vbox{\cup}\kern-.5ex}
116 % \def\mytoe{\kern-.5ex\vbox{\wedge}\kern-.5ex}
117 \def\myheel{\vbox{\cup}}
118 \def\mytoe{\vbox{\wedge}}
119 % \def\mystriepke{\kern-1.1ex\vbox{\hbox{\kern-.05em\striepke}}\kern-1.1ex}
120 \def\mystriepke{\kern-1.8ex\vbox{\hbox{\kern-.05em\striepke}}\kern-1.8ex}
122 \def\heel{\vbox{\myheel}}
123 \def\toe{\vbox{\mytoe}}
124 \def\backorfront{\mystriepke}
126 \def\bheel{\vbox{\myheel\mystriepke}}
127 \def\btoe{\vbox{\mytoe\mystriepke}}
128 \def\fheel{\vbox{\mystriepke\myheel}}
129 \def\ftoe{\vbox{\mystriepke\mytoe}}
130 \def\heeltoe{\vbox{\myheel\mytoe}}
131 \def\toeheel{\vbox{\mytoe\myheel}}
136 \def\defaultthinbar{\thinbar{\balkheight}}
137 \def\defaultthickbar{\thickbar{\balkheight}}
138 %? what-s wrong with rightalign?
139 \def\repeatstopbar{\hss\rightalign{\repeatcolon\hskip2\smallspace\defaultthinbar\hskip\smallspace\defaultthickbar}}
140 \def\repeatstartbar{\hbox{\defaultthickbar\kern\smallspace\defaultthinbar\kern2\smallspace\repeatcolon}}
141 \def\repeatstopstart{\hbox{\repeatcolon\kern2\smallspace\defaultthinbar\kern\smallspace\defaultthickbar\kern\smallspace\defaultthickbar\kern\smallspace\defaultthinbar\kern2\smallspace\repeatcolon}}
144 \def\repeatbar{\repeatstopbar}
145 \def\startrepeat{\repeatstartbar}
146 \def\repeatbarstartrepeat{\repeatstopstart}
150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
154 \def\doublebar#1{\hbox{\thinbar{#1}\hskip\smallspace\thinbar{#1}}}
155 \def\thinbar#1{\vrule height #1 width 1.6\staffrulethickness} % TODO parametric.
156 \def\thickbar#1{\vrule height #1 width 2\smallspace}
157 \def\maatstreep#1{\thinbar{#1}}
158 \def\startbar#1{\leftalign{\thickbar{#1}\kern\smallspace\thinbar{#1}}}
159 \def\finishbar#1{\rightalign{\thinbar{#1}\kern\smallspace\thickbar{#1}}}
161 \def\pianobrace#1{{\musicdraw\char#1}}
162 \def\slurcharh#1{{\slurhfont\char#1}}
163 \def\slurcharu#1{{\slurufont\char#1}}
164 \def\slurchard#1{{\slurdfont\char#1}}
165 \def\hslurcharh#1{{\hslurhfont\char#1}}
166 \def\hslurcharu#1{{\hslurufont\char#1}}
167 \def\hslurchard#1{{\hslurdfont\char#1}}
169 \def\generalmeter#1#2{\botalign{\vbox to0.5\balkheight{\vss \meterfont#1}%
171 \vbox to 0.5\balkheight{\vss\meterfont #2}}}
173 % stacked horizontal lines
175 \vbox{\kern-\interstaffrule
176 \n=0\nointerlineskip%
177 \loop\ifnum\n<#1\advance\n by1%
180 \vbox to 0pt{\hrule height #3 width#2%
181 \vss}\nointerlineskip
186 % Ugh. Need to redo this. Wish we had PS.
188 \def\toplines#1#2{\dist#1
189 \topalign{\hbox{\kern-.25\dist\lines{#2}{1.5\dist}{2\staffrulethickness}}}}
191 \def\botlines#1#2{\dist#1
192 \botalign{\hbox{\kern-.25\dist\lines{#2}{1.5\dist}{2\staffrulethickness}}}}
195 % a staffsymbol with #1 lines, width #2
197 \def\linestafsym#1#2{\leftalign{\botalign{\lines{#1}{#2}{\staffrulethickness}}}}
199 \def\stem#1#2{\vrule height#2 depth-#1}
201 \def\placebox#1#2#3{%
202 \botalign{\hbox{\raise #1\leftalign{\kern #2{}#3}}}%
206 \def\brace#1{\count0=148\advance\count0 by #1\musicdraw\char\count0}
207 \def\crescendosym#1{\count0=84\advance\count0 by #1\musicdraw\char\count0}
208 \def\decrescendosym#1{\count0=116\advance\count0 by #1\musicdraw\char\count0}
209 \def\rulesym#1#2{\vrule height #1 width #2}
210 \def\settext#1{\normaltextfont #1}
211 \def\setitalic#1{\italicfont #1}
212 \def\setdynamic#1{\dynfont #1}
214 % the interline symbol. Redefine to remove it.
215 \def\defaultlineseparator{\vbox{\mussepline\vskip -5pt\mussepline}}
216 \def\lineseparator{\defaultlineseparator}
218 \par\vskip 10pt plus 30pt minus 10pt\par
219 \hskip -5pt\lineseparator
220 \par\vskip 10pt plus 30pt minus 10pt\par
224 \def\interscoreline{\vskip 16pt}
226 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
227 % big fat marks, if errors are detected.
228 \def\columnerrormark{\placebox{-5pt}{0pt}{\bf C!}}
229 \def\scorelineerrormark{\placebox{0pt}{-10pt}{\bf L!}}
230 \def\errormark{{\bf E!}}
231 \def\unknown{{\bf u}}
234 \ifundefined{documentclass}
235 \footline={\ifnum\pageno=1
236 {\smalltextfont\mudelacopyright\hfil \LilyIdString
237 }\else{\hfil\the\pageno\hfil}\fi
241 \renewcommand{\@oddhead}{}%
242 \renewcommand{\@evenfoot}{}%
243 \renewcommand{\@evenhead}{}%
244 \renewcommand{\@oddfoot}{\ifnum\thepage=1
246 }\else{foo\hfil\the\pageno\hfil}\fi}}
248 \renewcommand{\@oddhead}{}%
249 \renewcommand{\@evenfoot}{}%
250 \renewcommand{\@evenhead}{}%
251 \renewcommand{\@oddfoot}{\ifnum\thepage=1
253 }\else{foo\hfil\the\pageno\hfil}\fi}}