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\stemthickness
59 \newdimen\staffrulethickness
60 \newdimen\interstaffrule
63 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
64 % set fonts and primary dimensions
72 \font\meterfont=cmbx15
73 \font\italicfont=cmti10
74 \font\musicmathfont=cmsy10
75 \font\normaltextfont=cmr10 %\textfont is a primitive
76 \font\smalltextfont=cmr8
78 \font\textmusic=cmmi12
81 \font\smalltextfont=cmr6
82 \font\normaltextfont=cmr8 %\textfont is a primitive
83 \font\meterfont=cmbx12
84 \font\italicfont=cmti8
85 \font\textmusic=cmmi10
89 \font\smalltextfont=cmr5
90 \font\normaltextfont=cmr6
92 \font\italicfont=cmti6
98 \font\smalltextfont=cmr6
99 \font\normaltextfont=cmr7
100 \font\meterfont=cmbx9
101 \font\italicfont=cmti7
102 \font\textmusic=cmmi9
105 \def\musixsixteendefs{
109 \def\musixtwentysixdefs{
113 \def\musixthirteendefs{
117 \def\musixelevendefs{
122 \def\textsharp{\raise.4ex\hbox{\textmusic\char"5D}}
123 \def\textnatural{\raise.4ex\hbox{\textmusic\char"5C}}
124 \def\textflat{\raise.2ex\hbox{\textmusic\char"5B}}
129 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
130 % do derivative calcs
132 % this has to be synced with the font definition
134 \staffheight=\mudelapaperbarsize pt
135 \interlinedist=\staffheight
136 \divide\interlinedist by 4
137 \notewidth=\mudelapapernotewidth pt
139 \smallspace=.3\interlinedist
140 \interstaffrule=\staffheight
141 \divide\interstaffrule by 4
142 \staffrulethickness=\mudelapaperrulethickness pt
143 \stemthickness=\staffrulethickness
146 % stacked numbers; may be overruled in fetdefs
147 \def\generalmeter#1#2{\vbox to 0pt{\vss\hbox{\meterfont
149 \hbox{\meterfont #2}\vss}}
151 % stacked horizontal lines
162 \def\defaultthinbar{\thinbar{\staffheight}}
163 \def\defaultthickbar{\thickbar{\staffheight}}
164 %? what-s wrong with rightalign?
165 \def\repeatstopbar{\hss\rightalign{\repeatcolon\hskip2\smallspace\defaultthinbar\hskip\smallspace\defaultthickbar}}
166 \def\repeatstartbar{\hbox{\defaultthickbar\kern\smallspace\defaultthinbar\kern2\smallspace\repeatcolon}}
167 \def\repeatstopstart{\hbox{\repeatcolon\kern2\smallspace\defaultthickbar\kern\smallspace\defaultthickbar\kern2\smallspace\repeatcolon}}
170 \def\repeatbar{\repeatstopbar}
171 \def\startrepeat{\repeatstartbar}
172 \def\repeatbarstartrepeat{\repeatstopstart}
182 \loop\ifdim\here<\wid\advance\here by\inc
183 \hbox to0pt{\vbox to0pt{\vss\hrule width2pt height 0.05pt\kern\here}\hss}%
186 \def\hruler#1#2{\hbox{%
192 \loop\ifdim\here<\wid\advance\here by #2
193 \hbox to0pt{\kern\here\vrule width0.05pt height 1pt depth 1pt\hss}%
198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
202 \def\doublebar#1{\hbox{\thinbar{#1}\hskip\smallspace\thinbar{#1}}}
203 \def\thinbar#1{\dimen0=#1%
204 \vrule height .5\dimen0 depth .5\dimen0 width 1.6\staffrulethickness} % TODO parametric.
205 \def\thickbar#1{\dimen0=#1%
206 \vrule height .5\dimen0 depth .5\dimen0 width 2\smallspace}
207 \def\maatstreep#1{\thinbar{#1}}
208 \def\startbar#1{\leftalign{\thickbar{#1}\kern\smallspace\thinbar{#1}}}
209 \def\finishbar#1{\rightalign{\thinbar{#1}\kern\smallspace\thickbar{#1}}}
212 \def\stem#1#2{\hbox{\kern -.5\stemthickness
213 \vrule width\stemthickness height#2 depth-#1}}
215 \def\placebox#1#2#3{%
216 \botalign{\hbox{\raise #1\leftalign{\kern #2{}#3}}}%
220 \def\rulesym#1#2{\dimen0=#1%
221 \vrule height .5\dimen0 depth .5\dimen0 width #2}
222 \def\settext#1{\normaltextfont #1}
223 \def\setitalic#1{\italicfont #1}
224 \def\setbold#1{\boldfont #1}
225 \def\setdynamic#1{\dynfont #1}
226 \def\setfinger#1{\fingerfont #1}
228 % the interline symbol. Redefine to remove it.
229 \def\defaultlineseparator{\vbox{\mussepline\vskip -5pt\mussepline}}
230 \def\lineseparator{\defaultlineseparator}
232 \par\vskip 10pt plus 30pt minus 10pt\par
233 \hskip -5pt\lineseparator
234 \par\vskip 10pt plus 30pt minus 10pt\par
238 \def\interscoreline{\vskip 16pt}
240 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
241 % big fat marks, if errors are detected.
242 \def\columnerrormark{\placebox{-5pt}{0pt}{\bf C!}}
243 \def\scorelineerrormark{\placebox{0pt}{-10pt}{\bf L!}}
244 \def\errormark{{\bf E!}}
245 \def\unknown{{\bf u}}
248 \ifundefined{documentclass}
249 \footline={\ifnum\pageno=1
250 {\smalltextfont\mudelacopyright\hfil \LilyIdString
251 }\else{\hfil\the\pageno\hfil}\fi
255 \renewcommand{\@oddhead}{}%
256 \renewcommand{\@evenfoot}{}%
257 \renewcommand{\@evenhead}{}%
258 \renewcommand{\@oddfoot}{\ifnum\thepage=1
260 }\else{foo\hfil\the\pageno\hfil}\fi}}
262 \renewcommand{\@oddhead}{}%
263 \renewcommand{\@evenfoot}{}%
264 \renewcommand{\@evenhead}{}%
265 \renewcommand{\@oddfoot}{\ifnum\thepage=1
267 }\else{foo\hfil\the\pageno\hfil}\fi}}
272 % \vbox to 0pt{\vskip .5cm \hruler{48}{3pt}\vss}