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
61 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
62 % set fonts and primary dimensions
67 \staffrulethickness=0.4pt
72 \def\musixsixteendefs{
74 \staffrulethickness=0.4pt
81 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
85 \interlinedist=\fontdimen5\musicfnt
86 \smallspace=.3\interlinedist
87 \interstaffrule=\balkheight
88 \divide\interstaffrule by 4
93 \def\kdynf{\dynfont \char0\kern-.2ex}
94 \def\kdynm{\dynfont \char1\kern-.18ex}
95 \def\kdynp{\dynfont \char2\kern-.08ex}
96 \def\kdyns{\dynfont \char3\kern-.22ex}
97 \def\kdynz{\dynfont \char4\kern-.2ex}
100 \def\dynpp{\dynp\kdynp}
101 \def\dynppp{\dynpp\kdynp}
102 \def\dynmp{\kdynm\kdynp}
103 \def\dynmf{\kdynm\kdynf}
105 \def\dynff{\dynf\kdynf}
106 \def\dynfff{\dynff\kdynf}
108 \def\dynfp{\kdynf\kern.35ex\kdynp}
109 \def\dynsf{\kdyns\kdynf}
110 \def\dynsfz{\dynsf\kern.3ex\kdynz}
114 \musicmathdef\cup{91} % \cup
115 \musicmathdef\wedge{94} % \wedge
116 \musicmathdef\striepke{0} % heu?
118 %% custom characters --- this should go: add to (meta!) font
119 % \def\myheel{\kern-.5ex\vbox{\cup}\kern-.5ex}
120 % \def\mytoe{\kern-.5ex\vbox{\wedge}\kern-.5ex}
121 \def\myheel{\vbox{\cup}}
122 \def\mytoe{\vbox{\wedge}}
123 % \def\mystriepke{\kern-1.1ex\vbox{\hbox{\kern-.05em\striepke}}\kern-1.1ex}
124 \def\mystriepke{\kern-1.8ex\vbox{\hbox{\kern-.05em\striepke}}\kern-1.8ex}
126 \def\heel{\vbox{\myheel}}
127 \def\toe{\vbox{\mytoe}}
128 \def\backorfront{\mystriepke}
130 \def\bheel{\vbox{\myheel\mystriepke}}
131 \def\btoe{\vbox{\mytoe\mystriepke}}
132 \def\fheel{\vbox{\mystriepke\myheel}}
133 \def\ftoe{\vbox{\mystriepke\mytoe}}
134 \def\heeltoe{\vbox{\myheel\mytoe}}
135 \def\toeheel{\vbox{\mytoe\myheel}}
140 \def\defaultthinbar{\thinbar{\balkheight}}
141 \def\defaultthickbar{\thickbar{\balkheight}}
142 %? what-s wrong with rightalign?
143 \def\repeatstopbar{\hss\rightalign{\repeatcolon\hskip2\smallspace\defaultthinbar\hskip\smallspace\defaultthickbar}}
144 \def\repeatstartbar{\hbox{\defaultthickbar\kern\smallspace\defaultthinbar\kern2\smallspace\repeatcolon}}
145 \def\repeatstopstart{\hbox{\repeatcolon\kern2\smallspace\defaultthinbar\kern\smallspace\defaultthickbar\kern\smallspace\defaultthickbar\kern\smallspace\defaultthinbar\kern2\smallspace\repeatcolon}}
148 \def\repeatbar{\repeatstopbar}
149 \def\startrepeat{\repeatstartbar}
150 \def\repeatbarstartrepeat{\repeatstopstart}
154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
156 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
158 \def\doublebar#1{\hbox{\thinbar{#1}\hskip\smallspace\thinbar{#1}}}
159 \def\thinbar#1{\vrule height #1 width 1.6\staffrulethickness} % TODO parametric.
160 \def\thickbar#1{\vrule height #1 width 2\smallspace}
161 \def\maatstreep#1{\thinbar{#1}}
162 \def\startbar#1{\leftalign{\thickbar{#1}\kern\smallspace\thinbar{#1}}}
163 \def\finishbar#1{\rightalign{\thinbar{#1}\kern\smallspace\thickbar{#1}}}
165 \def\pianobrace#1{{\musicdraw\char#1}}
166 \def\slurcharh#1{{\slurhfont\char#1}}
167 \def\slurcharu#1{{\slurufont\char#1}}
168 \def\slurchard#1{{\slurdfont\char#1}}
169 \def\hslurcharh#1{{\hslurhfont\char#1}}
170 \def\hslurcharu#1{{\hslurufont\char#1}}
171 \def\hslurchard#1{{\hslurdfont\char#1}}
173 \def\generalmeter#1#2{\botalign{\vbox to0.5\balkheight{\vss \meterfont#1}%
175 \vbox to 0.5\balkheight{\vss\meterfont #2}}}
177 % stacked horizontal lines
179 \vbox{\kern-\interstaffrule
180 \n=0\nointerlineskip%
181 \loop\ifnum\n<#1\advance\n by1%
184 \vbox to 0pt{\hrule height #3 width#2%
185 \vss}\nointerlineskip
190 % Ugh. Need to redo this. Wish we had PS.
192 \def\toplines#1{ % why space needed here?
193 \topalign{\hbox{\kern-\notewidth\lines{#1}{1.6\notewidth}{1.6\staffrulethickness}}}}
195 \def\botlines#1{ % idem ditto
196 \botalign{\hbox{\kern-\notewidth\lines{#1}{1.6\notewidth}{1.6\staffrulethickness}}}}
199 % a staffsymbol with #1 lines, width #2
201 \def\linestafsym#1#2{\leftalign{\botalign{\lines{#1}{#2}{\staffrulethickness}}}}
203 \def\stem#1#2{\vrule height#2 depth-#1}
205 \def\placebox#1#2#3{%
206 \botalign{\hbox{\raise #1\leftalign{\kern #2{}#3}}}%
210 \def\beamslope#1#2{{\count0=#2\advance\count0 by#1\musicfnt\char\count0}}
211 \def\brace#1{\count0=148\advance\count0 by #1\musicdraw\char\count0}
212 \def\crescendosym#1{\count0=84\advance\count0 by #1\musicdraw\char\count0}
213 \def\decrescendosym#1{\count0=116\advance\count0 by #1\musicdraw\char\count0}
214 \def\rulesym#1#2{\vrule height #1 width #2}
215 \def\settext#1{\normaltextfont #1}
216 \def\setitalic#1{\italicfont #1}
217 \def\setdynamic#1{\dynfont #1}
219 % the interline symbol. Redefine to remove it.
220 \def\defaultlineseparator{\vbox{\mussepline\vskip -5pt\mussepline}}
221 \def\lineseparator{\defaultlineseparator}
223 \par\vskip 10pt plus 30pt minus 10pt\par
224 \hskip -5pt\lineseparator
225 \par\vskip 10pt plus 30pt minus 10pt\par
229 \def\interscoreline{\vskip 16pt}
231 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
232 % big fat marks, if errors are detected.
233 \def\columnerrormark{\placebox{-5pt}{0pt}{\bf C!}}
234 \def\scorelineerrormark{\placebox{0pt}{-10pt}{\bf L!}}
235 \def\unknown{{\bf u}}
238 \ifundefined{documentclass}
239 \footline={\ifnum\pageno=1
240 {\smalltextfont\mudelacopyright\hfil \LilyIdString
241 }\else{\hfil\the\pageno\hfil}\fi
245 \renewcommand{\@oddhead}{}%
246 \renewcommand{\@evenfoot}{}%
247 \renewcommand{\@evenhead}{}%
248 \renewcommand{\@oddfoot}{\ifnum\thepage=1
250 }\else{foo\hfil\the\pageno\hfil}\fi}}