]> git.donarmstrong.com Git - lilypond.git/blob - tex/lilyponddefs.tex
patch::: 0.1.12.jcn3: dienamiek
[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
61 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
62 % set fonts and primary dimensions
63 \def\musixtwentydefs{
64         \balkheight=20pt
65         \notewidth=6pt
66         \noteheight=5pt
67         \staffrulethickness=0.4pt
68         \musixtwentyfonts
69         \musixcalc
70 }
71
72 \def\musixsixteendefs{
73         \balkheight=16pt
74         \staffrulethickness=0.4pt
75         \notewidth=5pt
76         \noteheight=4pt
77         \musixsixteenfonts
78         \musixcalc
79 }
80
81 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
82 % do derivative calcs
83
84 \def\musixcalc{
85         \interlinedist=\fontdimen5\musicfnt
86         \smallspace=.3\interlinedist
87         \interstaffrule=\balkheight
88         \divide\interstaffrule by 4
89 }
90
91
92 \def\dyn{\dynfont}
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}
98
99 \def\dynp{\kdynp}
100 \def\dynpp{\dynp\kdynp}
101 \def\dynppp{\dynpp\kdynp}
102 \def\dynmp{\kdynm\kdynp}
103 \def\dynmf{\kdynm\kdynf}
104 \def\dynf{\kdynf}
105 \def\dynff{\dynf\kdynf}
106 \def\dynfff{\dynff\kdynf}
107
108 \def\dynfp{\kdynf\kern.35ex\kdynp}
109 \def\dynsf{\kdyns\kdynf}
110 \def\dynsfz{\dynsf\kern.3ex\kdynz}
111
112 \input taupindefs
113
114 \musicmathdef\cup{91} % \cup
115 \musicmathdef\wedge{94} % \wedge
116 \musicmathdef\striepke{0} % heu?
117
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}
125
126 \def\heel{\vbox{\myheel}}
127 \def\toe{\vbox{\mytoe}}
128 \def\backorfront{\mystriepke}
129
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}}
136 %%
137
138 \def\emptybar{}
139
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}}
146
147 %compatibility
148 \def\repeatbar{\repeatstopbar}
149 \def\startrepeat{\repeatstartbar}
150 \def\repeatbarstartrepeat{\repeatstopstart}
151
152
153
154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
155 % parametric symbols
156 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
157
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}}}
164
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}}
172 % stacked numbers
173 \def\generalmeter#1#2{\botalign{\vbox to0.5\balkheight{\vss \meterfont#1}%
174         \nointerlineskip
175         \vbox to 0.5\balkheight{\vss\meterfont #2}}}
176
177 % stacked horizontal lines 
178 \def\lines#1#2#3{%
179  \vbox{\kern-\interstaffrule
180         \n=0\nointerlineskip%
181         \loop\ifnum\n<#1\advance\n by1%
182                 \kern\interstaffrule
183                 \nointerlineskip
184                 \vbox to 0pt{\hrule height #3 width#2%
185                         \vss}\nointerlineskip
186                 \repeat
187         }}
188
189 %%
190 % Ugh. Need to redo this. Wish we had PS.
191 %
192 \def\toplines#1{ % why space needed here?
193         \topalign{\hbox{\kern-\notewidth\lines{#1}{1.6\notewidth}{1.6\staffrulethickness}}}}
194
195 \def\botlines#1{ % idem ditto
196         \botalign{\hbox{\kern-\notewidth\lines{#1}{1.6\notewidth}{1.6\staffrulethickness}}}}
197
198 %
199 % a staffsymbol with #1 lines, width #2
200 % bottom at baseline
201 \def\linestafsym#1#2{\leftalign{\botalign{\lines{#1}{#2}{\staffrulethickness}}}}
202
203 \def\stem#1#2{\vrule height#2 depth-#1}
204
205 \def\placebox#1#2#3{%
206         \botalign{\hbox{\raise #1\leftalign{\kern #2{}#3}}}%
207 }
208
209
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}
218
219 % the interline symbol. Redefine to remove it.
220 \def\defaultlineseparator{\vbox{\mussepline\vskip -5pt\mussepline}}
221 \def\lineseparator{\defaultlineseparator}
222 \def\beauty{%
223         \par\vskip 10pt plus 30pt minus 10pt\par
224         \hskip -5pt\lineseparator
225         \par\vskip 10pt plus 30pt minus 10pt\par
226 }
227
228
229 \def\interscoreline{\vskip 16pt}
230         
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}}
236
237 \def\postheader{}
238 \ifundefined{documentclass}
239         \footline={\ifnum\pageno=1
240         {\smalltextfont\mudelacopyright\hfil \LilyIdString
241         }\else{\hfil\the\pageno\hfil}\fi
242 }\else
243         %% FIXME
244         \def\ps@plain{
245                 \renewcommand{\@oddhead}{}%
246                 \renewcommand{\@evenfoot}{}%
247                 \renewcommand{\@evenhead}{}%
248                 \renewcommand{\@oddfoot}{\ifnum\thepage=1
249         {\hfil \LilyIdString
250         }\else{foo\hfil\the\pageno\hfil}\fi}}
251 \fi