]> git.donarmstrong.com Git - lilypond.git/blob - tex/lilyponddefs.tex
release: 0.0.67
[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
18 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
19 % macros to shorten other definitions
20 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
21 \def\mdef#1#2{\def#1{\mchar{#2}}}
22 \def\mchar#1{\musicfnt\char#1}
23 \def\rationalmultiply#1*#2/#3{\multiply #1 by #2 \divide #1 by #3}
24 \def\maccentraise#1#2{\dimen0=\noteheight
25         \rationalmultiply\dimen0*#2%
26         \raise\dimen0\hbox{#1}}
27 \def\maccentdef#1#2#3{\def#1{\maccentraise{\mchar{#2}}{#3}}}
28 \def\vertcenter#1{\vbox to 0pt{\vss #1\vss}}
29
30 \def\mathdef#1#2{\def#1{\mathchar{#2}}}
31 \def\mathchar#1{\mathfont\char#1}
32
33 \def\topalign#1{\vbox to 0pt{#1\vss}}
34 \def\botalign#1{\vbox to 0pt{\vss #1}}
35
36 \def\centeralign#1{\hbox to 0pt{\hss#1\hss}}
37 \def\leftalign#1{\hbox to 0pt{#1\hss}}
38 \def\rightalign#1{\hbox to 0pt{\hss#1}}
39
40
41 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
42 %% set up dimensions
43 \parindent=0pt
44 \newdimen\smallspace
45 \newdimen\interlinedist
46 \newcount\n
47 \newdimen\balkheight
48 \newdimen\notewidth
49 \newdimen\noteheight
50 \newdimen\staffrulethickness
51 \newdimen\interstaffrule
52
53 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54 % set fonts and primary dimensions
55 \def\musixtwentydefs{
56         \font\textfont=cmr10
57         \font\meterfont=cmbx12
58         \font\slurufont=xslu20
59         \font\slurdfont=xsld20
60         \font\slurhfont=xslz20
61         \font\hslurufont=xslhu20
62         \font\hslurdfont=xslhd20
63         \font\hslurhfont=xslhz20
64         \font\musicfnt=musix20
65         \font\musicdraw=musixsps
66         \font\italicfont=cmti10
67         \font\dynfont=cmbxti10 scaled \magstep1
68         \font\mathfont=cmsy10
69         \balkheight=20pt
70         \notewidth=6pt
71         \noteheight=5pt
72         \staffrulethickness=0.4pt
73         \musixcalc
74 }
75
76
77 \def\musixsixteendefs{
78         \font\textfont=cmr8
79         \font\meterfont=cmbx12
80         \font\italicfont=cmti8
81         \font\slurufont=xslu16
82         \font\slurdfont=xsld16
83         \font\slurhfont=xslz20 % sigh
84         \font\hslurufont=xslhu16
85         \font\hslurdfont=xslhd16
86         \font\hslurhfont=xslhz20
87         \font\musicfnt=musix16
88         \font\dynfont=cmbxti12
89         \font\musicdraw=musixsps
90         \font\mathfont=cmsy8
91         \balkheight=16pt
92         \staffrulethickness=0.4pt
93         \notewidth=5pt
94         \noteheight=4pt
95         \musixcalc
96 }
97
98 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
99 % do derivative calcs
100
101 \def\musixcalc{
102         \interlinedist=\fontdimen5\musicfnt
103         \smallspace=.3\interlinedist
104         \interstaffrule=\balkheight
105         \divide\interstaffrule by 4
106 }
107
108 % dynamics take extra kerning
109 \def\dyn{\dynfont}
110 \def\kdynf{\dynfont f\kern-.1ex}
111 \def\kdynm{\dynfont m\kern-.15ex}
112 \def\kdynp{\dynfont p\kern-.15ex}
113
114
115 \def\dynp{\dynfont p}
116 \def\dynpp{\dynp\kdynp}
117 \def\dynppp{\dynpp\kdynp}
118 \def\dynmp{\dynfont m\kdynp}
119 \def\dynmf{\dynfont m\kdynf}
120 \def\dynf{\dynfont f}
121 \def\dynff{\dynf\kdynf}
122 \def\dynfff{\dynff\kdynf}
123
124
125 \input taupindefs
126
127 \mathdef\cup{91} % \cup
128 \mathdef\wedge{94} % \wedge
129 \mathdef\striepke{0} % heu?
130
131 %% custom characters --- this should go: add to (meta!) font
132 % \def\myheel{\kern-.5ex\vbox{\cup}\kern-.5ex}
133 % \def\mytoe{\kern-.5ex\vbox{\wedge}\kern-.5ex}
134 \def\myheel{\vbox{\cup}}
135 \def\mytoe{\vbox{\wedge}}
136 % \def\mystriepke{\kern-1.1ex\vbox{\hbox{\kern-.05em\striepke}}\kern-1.1ex}
137 \def\mystriepke{\kern-1.8ex\vbox{\hbox{\kern-.05em\striepke}}\kern-1.8ex}
138
139 \def\heel{\vbox{\myheel}}
140 \def\toe{\vbox{\mytoe}}
141 \def\backorfront{\mystriepke}
142
143 \def\bheel{\vbox{\myheel\mystriepke}}
144 \def\btoe{\vbox{\mytoe\mystriepke}}
145 \def\fheel{\vbox{\mystriepke\myheel}}
146 \def\ftoe{\vbox{\mystriepke\mytoe}}
147 \def\heeltoe{\vbox{\myheel\mytoe}}
148 \def\toeheel{\vbox{\mytoe\myheel}}
149 %%
150
151 \def\emptybar{}
152
153 \def\thinbar{\vrule height\balkheight width 1.6\staffrulethickness} % TODO parametric.
154 \def\thickbar{\vrule height\balkheight width 2\smallspace}
155 \def\maatstreep{\thinbar}
156
157 %? what-s wrong with rightalign?
158 \def\finishbar{\rightalign{\thinbar\kern\smallspace\thickbar}}
159
160 \def\repeatstopbar{\hss\rightalign{\repeatcolon\hskip2\smallspace\thinbar\hskip\smallspace\thickbar}}
161 \def\repeatstartbar{\hbox{\thickbar\kern\smallspace\thinbar\kern2\smallspace\repeatcolon}}
162 \def\repeatstopstart{\hbox{\repeatcolon\kern2\smallspace\thinbar\kern\smallspace\thickbar\kern\smallspace\thickbar\kern\smallspace\thinbar\kern2\smallspace\repeatcolon}}
163 \def\doublebar{\hbox{\thinbar\hskip\smallspace\thinbar}}
164
165 %compatibility
166 \def\repeatbar{\repeatstopbar}
167 \def\startrepeat{\repeatstartbar}
168 \def\repeatbarstartrepeat{\repeatstopstart}
169
170 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
171 % parametric symbols
172 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
173
174 \def\slurcharh#1{{\slurhfont\char#1}}
175 \def\slurcharu#1{{\slurufont\char#1}}
176 \def\slurchard#1{{\slurdfont\char#1}}
177 \def\hslurcharh#1{{\hslurhfont\char#1}}
178 \def\hslurcharu#1{{\hslurufont\char#1}}
179 \def\hslurchard#1{{\hslurdfont\char#1}}
180 % stacked numbers
181 \def\generalmeter#1#2{\botalign{\vbox to0.5\balkheight{\vss \meterfont#1}%
182         \nointerlineskip
183         \vbox to 0.5\balkheight{\vss\meterfont #2}}}
184
185 % stacked horizontal lines 
186 \def\lines#1#2#3{%
187  \vbox{\kern-\interstaffrule
188         \n=0\nointerlineskip%
189         \loop\ifnum\n<#1\advance\n by1%
190                 \kern\interstaffrule
191                 \nointerlineskip
192                 \vbox to 0pt{\hrule height #3 width#2%
193                         \vss}\nointerlineskip
194                 \repeat
195         }}
196
197 %%
198 % Ugh. Need to redo this. Wish we had PS.
199 %
200 \def\toplines#1{ % why space needed here?
201         \topalign{\hbox{\kern-\notewidth\lines{#1}{1.6\notewidth}{1.6\staffrulethickness}}}}
202
203 \def\botlines#1{ % idem ditto
204         \botalign{\hbox{\kern-\notewidth\lines{#1}{1.6\notewidth}{1.6\staffrulethickness}}}}
205
206 %
207 % a staffsymbol with #1 lines, width #2
208 % bottom at baseline
209 \def\linestafsym#1#2{\leftalign{\botalign{\lines{#1}{#2}{\staffrulethickness}}}}
210
211 \def\stem#1#2{\vrule height#2 depth-#1}
212
213 \def\placebox#1#2#3{%
214         \botalign{\hbox{\raise #1\leftalign{\kern #2{}#3}}}%
215 }
216
217
218 \def\beamslope#1#2{{\count0=#2\advance\count0 by#1\musicfnt\char\count0}}
219 \def\rulesym#1#2{\vrule height #1 width #2}
220 \def\crescendosym#1{\count0=84\advance\count0 by #1\musicdraw\char\count0}
221 \def\decrescendosym#1{\count0=116\advance\count0 by #1\musicdraw\char\count0}
222 \def\settext#1{\textfont #1}
223 \def\setitalic#1{\italicfont #1}
224 \def\setdynamic#1{\dynfont #1}
225
226 % the interline symbol. Redefine to remove it.
227 \def\defaultlineseparator{\vbox{\mussepline\vskip -5pt\mussepline}}
228 \def\lineseparator{\defaultlineseparator}
229 \def\beauty{%
230         \par\vskip 10pt plus 30pt minus 10pt\par
231         \hskip -5pt\lineseparator
232         \par\vskip 10pt plus 30pt minus 10pt\par
233 }
234
235
236 % redefine if not happy with interline spacing
237 %
238 \def\interstaffline{%
239         \vskip 10pt
240 }
241 \def\interscoreline{\beauty}
242         
243 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
244 % big fat marks, if errors are detected.
245 \def\columnerrormark{\placebox{-5pt}{0pt}{\bf C!}}
246 \def\scorelineerrormark{\placebox{0pt}{-10pt}{\bf L!}}