]> git.donarmstrong.com Git - lilypond.git/blob - tex/lilyponddefs.tex
patch::: 0.1.16.jcn1: grotere bolletjes
[lilypond.git] / tex / lilyponddefs.tex
1 %%
2 %% include file for LilyPond
3 %%
4 %% this file defines various macros to accomodate lilypond output
5
6 % TeXbook ex 7.7
7 \def\ifundefined#1{\expandafter\ifx\csname#1\endcsname\relax}
8
9 % skip if included already
10 \def\SkipLilydefs{\endinput}
11 \ifundefined{EndLilyPondOutput}
12         \def\EndLilyPondOutput{\csname bye\endcsname}
13         \def\SkipLilydefs{}
14 \fi
15 \SkipLilydefs
16
17 \ifundefined{mudelacopyright}
18         \def\mudelacopyright{\copyright\ \number\year}
19 \fi
20 \ifundefined{LilyIdString}
21         \def\LilyIdString{Lily was here}
22 \fi
23
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}
30
31
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}}
37
38 \def\musicmathdef#1#2{\def#1{\musicmathchar{#2}}}
39 \def\musicmathchar#1{\musicmathfont\char#1}
40
41 \def\topalign#1{\vbox to 0pt{#1\vss}}
42 \def\botalign#1{\vbox to 0pt{\vss #1}}
43
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}}
47
48
49 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50 %% set up dimensions
51 \parindent=0pt
52 \newdimen\smallspace
53 \newdimen\interlinedist
54 \newcount\n
55 \newdimen\balkheight
56 \newdimen\notewidth
57 \newdimen\noteheight
58 \newdimen\staffrulethickness
59 \newdimen\interstaffrule
60 \newdimen\dist
61
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63 % set fonts and primary dimensions
64 % ugh
65 \def\musixtwentydefs{
66         \balkheight=20pt
67         \notewidth=7.15pt
68         \noteheight=5pt
69         \staffrulethickness=0.4pt
70         \musixtwentyfonts
71         \font\textmusic=cmmi12
72         \musixcalc
73 }
74
75 \def\musixsixteendefs{
76         \balkheight=16pt
77         \staffrulethickness=0.4pt
78         \notewidth=5.93pt
79         \noteheight=4pt
80         \musixsixteenfonts
81         \font\textmusic=cmmi10
82         \musixcalc
83 }
84
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}}
88
89
90
91
92 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
93 % do derivative calcs
94
95 \def\musixcalc{
96         \interlinedist=\fontdimen5\musicfnt
97         \smallspace=.3\interlinedist
98         \interstaffrule=\balkheight
99         \divide\interstaffrule by 4
100 }
101
102
103 \input dyndefs
104
105 \input taupindefs
106
107 \musicmathdef\cup{91} % \cup
108 \musicmathdef\wedge{94} % \wedge
109 \musicmathdef\striepke{0} % heu?
110
111 %% custom characters --- this should go: add to (meta!) font
112 % \def\myheel{\kern-.5ex\vbox{\cup}\kern-.5ex}
113 % \def\mytoe{\kern-.5ex\vbox{\wedge}\kern-.5ex}
114 \def\myheel{\vbox{\cup}}
115 \def\mytoe{\vbox{\wedge}}
116 % \def\mystriepke{\kern-1.1ex\vbox{\hbox{\kern-.05em\striepke}}\kern-1.1ex}
117 \def\mystriepke{\kern-1.8ex\vbox{\hbox{\kern-.05em\striepke}}\kern-1.8ex}
118
119 \def\heel{\vbox{\myheel}}
120 \def\toe{\vbox{\mytoe}}
121 \def\backorfront{\mystriepke}
122
123 \def\bheel{\vbox{\myheel\mystriepke}}
124 \def\btoe{\vbox{\mytoe\mystriepke}}
125 \def\fheel{\vbox{\mystriepke\myheel}}
126 \def\ftoe{\vbox{\mystriepke\mytoe}}
127 \def\heeltoe{\vbox{\myheel\mytoe}}
128 \def\toeheel{\vbox{\mytoe\myheel}}
129 %%
130
131 \def\emptybar{}
132
133 \def\defaultthinbar{\thinbar{\balkheight}}
134 \def\defaultthickbar{\thickbar{\balkheight}}
135 %? what-s wrong with rightalign?
136 \def\repeatstopbar{\hss\rightalign{\repeatcolon\hskip2\smallspace\defaultthinbar\hskip\smallspace\defaultthickbar}}
137 \def\repeatstartbar{\hbox{\defaultthickbar\kern\smallspace\defaultthinbar\kern2\smallspace\repeatcolon}}
138 \def\repeatstopstart{\hbox{\repeatcolon\kern2\smallspace\defaultthinbar\kern\smallspace\defaultthickbar\kern\smallspace\defaultthickbar\kern\smallspace\defaultthinbar\kern2\smallspace\repeatcolon}}
139
140 %compatibility
141 \def\repeatbar{\repeatstopbar}
142 \def\startrepeat{\repeatstartbar}
143 \def\repeatbarstartrepeat{\repeatstopstart}
144
145
146
147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
148 % parametric symbols
149 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
150
151 \def\doublebar#1{\hbox{\thinbar{#1}\hskip\smallspace\thinbar{#1}}}
152 \def\thinbar#1{\vrule height #1 width 1.6\staffrulethickness} % TODO parametric.
153 \def\thickbar#1{\vrule height #1 width 2\smallspace}
154 \def\maatstreep#1{\thinbar{#1}}
155 \def\startbar#1{\leftalign{\thickbar{#1}\kern\smallspace\thinbar{#1}}}
156 \def\finishbar#1{\rightalign{\thinbar{#1}\kern\smallspace\thickbar{#1}}}
157
158 \def\pianobrace#1{{\musicdraw\char#1}}
159 \def\slurcharh#1{{\slurhfont\char#1}}
160 \def\slurcharu#1{{\slurufont\char#1}}
161 \def\slurchard#1{{\slurdfont\char#1}}
162 \def\hslurcharh#1{{\hslurhfont\char#1}}
163 \def\hslurcharu#1{{\hslurufont\char#1}}
164 \def\hslurchard#1{{\hslurdfont\char#1}}
165 % stacked numbers
166 \def\generalmeter#1#2{\botalign{\vbox to0.5\balkheight{\vss \meterfont#1}%
167         \nointerlineskip
168         \vbox to 0.5\balkheight{\vss\meterfont #2}}}
169
170 % stacked horizontal lines 
171 \def\lines#1#2#3{%
172  \vbox{\kern-\interstaffrule
173         \n=0\nointerlineskip%
174         \loop\ifnum\n<#1\advance\n by1%
175                 \kern\interstaffrule
176                 \nointerlineskip
177                 \vbox to 0pt{\hrule height #3 width#2%
178                         \vss}\nointerlineskip
179                 \repeat
180         }}
181
182 %%
183 % Ugh. Need to redo this. Wish we had PS.
184 %
185 \def\toplines#1#2{ % why space needed here?
186         \dist#1
187         % ugh, lily still uses "notewith" for all heads
188         \topalign{\hbox{\kern-.50\notewidth\kern-.25\dist\lines{#2}{1.5\dist}{2\staffrulethickness}}}}
189
190 \def\botlines#1#2{ % idem ditto
191         \dist#1
192         \botalign{\hbox{\kern-.50\notewidth\kern-.25\dist\lines{#2}{1.5\dist}{2\staffrulethickness}}}}
193
194 %
195 % a staffsymbol with #1 lines, width #2
196 % bottom at baseline
197 \def\linestafsym#1#2{\leftalign{\botalign{\lines{#1}{#2}{\staffrulethickness}}}}
198
199 \def\stem#1#2{\vrule height#2 depth-#1}
200
201 \def\placebox#1#2#3{%
202         \botalign{\hbox{\raise #1\leftalign{\kern #2{}#3}}}%
203 }
204
205
206 \def\beamslope#1#2{{\count0=#2\advance\count0 by#1\musicfnt\char\count0}}
207 \def\brace#1{\count0=148\advance\count0 by #1\musicdraw\char\count0}
208 \def\crescendosym#1{\count0=84\advance\count0 by #1\musicdraw\char\count0}
209 \def\decrescendosym#1{\count0=116\advance\count0 by #1\musicdraw\char\count0}
210 \def\rulesym#1#2{\vrule height #1 width #2}
211 \def\settext#1{\normaltextfont #1}
212 \def\setitalic#1{\italicfont #1}
213 \def\setdynamic#1{\dynfont #1}
214
215 % the interline symbol. Redefine to remove it.
216 \def\defaultlineseparator{\vbox{\mussepline\vskip -5pt\mussepline}}
217 \def\lineseparator{\defaultlineseparator}
218 \def\beauty{%
219         \par\vskip 10pt plus 30pt minus 10pt\par
220         \hskip -5pt\lineseparator
221         \par\vskip 10pt plus 30pt minus 10pt\par
222 }
223
224
225 \def\interscoreline{\vskip 16pt}
226         
227 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
228 % big fat marks, if errors are detected.
229 \def\columnerrormark{\placebox{-5pt}{0pt}{\bf C!}}
230 \def\scorelineerrormark{\placebox{0pt}{-10pt}{\bf L!}}
231 \def\errormark{{\bf E!}}
232 \def\unknown{{\bf u}}
233
234 \def\postheader{}
235 \ifundefined{documentclass}
236         \footline={\ifnum\pageno=1
237         {\smalltextfont\mudelacopyright\hfil \LilyIdString
238         }\else{\hfil\the\pageno\hfil}\fi
239 }\else
240         %% FIXME
241         \def\ps@plain{
242                 \renewcommand{\@oddhead}{}%
243                 \renewcommand{\@evenfoot}{}%
244                 \renewcommand{\@evenhead}{}%
245                 \renewcommand{\@oddfoot}{\ifnum\thepage=1
246         {\hfil \LilyIdString
247         }\else{foo\hfil\the\pageno\hfil}\fi}}
248         \def\ps@empty{
249                 \renewcommand{\@oddhead}{}%
250                 \renewcommand{\@evenfoot}{}%
251                 \renewcommand{\@evenhead}{}%
252                 \renewcommand{\@oddfoot}{\ifnum\thepage=1
253         {\hfil \LilyIdString
254         }\else{foo\hfil\the\pageno\hfil}\fi}}
255 \fi
256
257