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
54 \newdimen\ledgerlinethickness
55 \newdimen\stemthickness
60 \newdimen\staffrulethickness
61 \newdimen\interstaffrule
64 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65 % set fonts and primary dimensions
72 \font\textmusic=cmmi12
76 \def\musixsixteendefs{
81 \font\textmusic=cmmi10
85 \def\textsharp{\raise.4ex\hbox{\textmusic\char"5D}}
86 \def\textnatural{\raise.4ex\hbox{\textmusic\char"5C}}
87 \def\textflat{\raise.2ex\hbox{\mus\char"5B}}
92 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
95 % FIXME: should read from TFM/AFM/fetalog
98 % this has to be synced with the font definition
100 \interlinedist=\fontdimen5\musicfnt
101 \smallspace=.3\interlinedist
102 \interstaffrule=\balkheight
103 \divide\interstaffrule by 4
105 % [D.K.Roush & J.S.Gourlay] say this should be 0.072
107 \staffrulethickness=0.1\interlinedist
108 \stemthickness=\staffrulethickness
109 \ledgerlinethickness=2\staffrulethickness
112 % stacked numbers; may be overruled in fetdefs
113 \def\generalmeter#1#2{\vbox to 0pt{\vss\hbox{\meterfont
115 \hbox{\meterfont #2}\vss}}
117 % stacked horizontal lines
124 \musicmathdef\cup{91} % \cup
125 \musicmathdef\wedge{94} % \wedge
126 \musicmathdef\striepke{0} % heu?
128 %% custom characters --- this should go: add to (meta!) font
129 % \def\myheel{\kern-.5ex\vbox{\cup}\kern-.5ex}
130 % \def\mytoe{\kern-.5ex\vbox{\wedge}\kern-.5ex}
131 \def\myheel{\vbox{\cup}}
132 \def\mytoe{\vbox{\wedge}}
133 % \def\mystriepke{\kern-1.1ex\vbox{\hbox{\kern-.05em\striepke}}\kern-1.1ex}
134 \def\mystriepke{\kern-1.8ex\vbox{\hbox{\kern-.05em\striepke}}\kern-1.8ex}
136 \def\heel{\vbox{\myheel}}
137 \def\toe{\vbox{\mytoe}}
138 \def\backorfront{\mystriepke}
140 \def\bheel{\vbox{\myheel\mystriepke}}
141 \def\btoe{\vbox{\mytoe\mystriepke}}
142 \def\fheel{\vbox{\mystriepke\myheel}}
143 \def\ftoe{\vbox{\mystriepke\mytoe}}
144 \def\heeltoe{\vbox{\myheel\mytoe}}
145 \def\toeheel{\vbox{\mytoe\myheel}}
150 \def\defaultthinbar{\thinbar{\balkheight}}
151 \def\defaultthickbar{\thickbar{\balkheight}}
152 %? what-s wrong with rightalign?
153 \def\repeatstopbar{\hss\rightalign{\repeatcolon\hskip2\smallspace\defaultthinbar\hskip\smallspace\defaultthickbar}}
154 \def\repeatstartbar{\hbox{\defaultthickbar\kern\smallspace\defaultthinbar\kern2\smallspace\repeatcolon}}
155 \def\repeatstopstart{\hbox{\repeatcolon\kern2\smallspace\defaultthinbar\kern\smallspace\defaultthickbar\kern\smallspace\defaultthickbar\kern\smallspace\defaultthinbar\kern2\smallspace\repeatcolon}}
158 \def\repeatbar{\repeatstopbar}
159 \def\startrepeat{\repeatstartbar}
160 \def\repeatbarstartrepeat{\repeatstopstart}
170 \loop\ifdim\here<\wid\advance\here by\inc
171 \hbox to0pt{\vbox to0pt{\vss\hrule width2pt height 0.05pt\kern\here}\hss}%
174 \def\hruler#1#2{\hbox{%
180 \loop\ifdim\here<\wid\advance\here by #2
181 \hbox to0pt{\kern\here\vrule width0.05pt height 1pt depth 1pt\hss}%
186 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
188 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
190 \def\doublebar#1{\hbox{\thinbar{#1}\hskip\smallspace\thinbar{#1}}}
191 \def\thinbar#1{\vrule height #1 width 1.6\staffrulethickness} % TODO parametric.
192 \def\thickbar#1{\vrule height #1 width 2\smallspace}
193 \def\maatstreep#1{\thinbar{#1}}
194 \def\startbar#1{\leftalign{\thickbar{#1}\kern\smallspace\thinbar{#1}}}
195 \def\finishbar#1{\rightalign{\thinbar{#1}\kern\smallspace\thickbar{#1}}}
197 \def\pianobrace#1{{\musicdraw\char#1}}
198 \def\slurcharh#1{{\slurhfont\char#1}}
199 \def\slurcharu#1{{\slurufont\char#1}}
200 \def\slurchard#1{{\slurdfont\char#1}}
201 \def\hslurcharh#1{{\hslurhfont\char#1}}
202 \def\hslurcharu#1{{\hslurufont\char#1}}
203 \def\hslurchard#1{{\hslurdfont\char#1}}
206 \vbox{\kern-\interstaffrule
207 \n=0\nointerlineskip%
208 \loop\ifnum\n<#1\advance\n by1%
211 \vbox to 0pt{\hrule height .5#3 depth .5#3 width#2%
212 \vss}\nointerlineskip
217 % Ugh. Need to redo this. Wish we had PS.
219 \def\topledgerlines#1#2{\dist#1
220 \topalign{\hbox{\kern-.25\dist\lines{#2}{1.5\dist}{\ledgerlinethickness}}}}
222 \def\botledgerlines#1#2{\dist#1
223 \botalign{\hbox{\kern-.25\dist\lines{#2}{1.5\dist}{\ledgerlinethickness}}}}
226 % a staffsymbol with #1 lines, width #2
228 \def\linestafsym#1#2{\leftalign{\botalign{\lines{#1}{#2}{\staffrulethickness}}}}
230 \def\stem#1#2{\hbox{\kern -.5\stemthickness
231 \vrule width\stemthickness height#2 depth-#1}}
233 \def\placebox#1#2#3{%
234 \botalign{\hbox{\raise #1\leftalign{\kern #2{}#3}}}%
238 \def\brace#1{\count0=148\advance\count0 by #1\musicdraw\char\count0}
239 \def\crescendosym#1{\count0=84\advance\count0 by #1\musicdraw\char\count0}
240 \def\decrescendosym#1{\count0=116\advance\count0 by #1\musicdraw\char\count0}
241 \def\rulesym#1#2{\vrule height #1 width #2}
242 \def\settext#1{\normaltextfont #1}
243 \def\setitalic#1{\italicfont #1}
244 \def\setdynamic#1{\dynfont #1}
246 % the interline symbol. Redefine to remove it.
247 \def\defaultlineseparator{\vbox{\mussepline\vskip -5pt\mussepline}}
248 \def\lineseparator{\defaultlineseparator}
250 \par\vskip 10pt plus 30pt minus 10pt\par
251 \hskip -5pt\lineseparator
252 \par\vskip 10pt plus 30pt minus 10pt\par
256 \def\interscoreline{\vskip 16pt}
258 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
259 % big fat marks, if errors are detected.
260 \def\columnerrormark{\placebox{-5pt}{0pt}{\bf C!}}
261 \def\scorelineerrormark{\placebox{0pt}{-10pt}{\bf L!}}
262 \def\errormark{{\bf E!}}
263 \def\unknown{{\bf u}}
266 \ifundefined{documentclass}
267 \footline={\ifnum\pageno=1
268 {\smalltextfont\mudelacopyright\hfil \LilyIdString
269 }\else{\hfil\the\pageno\hfil}\fi
273 \renewcommand{\@oddhead}{}%
274 \renewcommand{\@evenfoot}{}%
275 \renewcommand{\@evenhead}{}%
276 \renewcommand{\@oddfoot}{\ifnum\thepage=1
278 }\else{foo\hfil\the\pageno\hfil}\fi}}
280 \renewcommand{\@oddhead}{}%
281 \renewcommand{\@evenfoot}{}%
282 \renewcommand{\@evenhead}{}%
283 \renewcommand{\@oddfoot}{\ifnum\thepage=1
285 }\else{foo\hfil\the\pageno\hfil}\fi}}
290 % \vbox to 0pt{\vskip .5cm \hruler{48}{3pt}\vss}