]> git.donarmstrong.com Git - lilypond.git/blob - tex/lilyponddefs.tex
patch::: 0.1.12.jcn4: dynpats
[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 \input dyndefs
93
94 \input taupindefs
95
96 \musicmathdef\cup{91} % \cup
97 \musicmathdef\wedge{94} % \wedge
98 \musicmathdef\striepke{0} % heu?
99
100 %% custom characters --- this should go: add to (meta!) font
101 % \def\myheel{\kern-.5ex\vbox{\cup}\kern-.5ex}
102 % \def\mytoe{\kern-.5ex\vbox{\wedge}\kern-.5ex}
103 \def\myheel{\vbox{\cup}}
104 \def\mytoe{\vbox{\wedge}}
105 % \def\mystriepke{\kern-1.1ex\vbox{\hbox{\kern-.05em\striepke}}\kern-1.1ex}
106 \def\mystriepke{\kern-1.8ex\vbox{\hbox{\kern-.05em\striepke}}\kern-1.8ex}
107
108 \def\heel{\vbox{\myheel}}
109 \def\toe{\vbox{\mytoe}}
110 \def\backorfront{\mystriepke}
111
112 \def\bheel{\vbox{\myheel\mystriepke}}
113 \def\btoe{\vbox{\mytoe\mystriepke}}
114 \def\fheel{\vbox{\mystriepke\myheel}}
115 \def\ftoe{\vbox{\mystriepke\mytoe}}
116 \def\heeltoe{\vbox{\myheel\mytoe}}
117 \def\toeheel{\vbox{\mytoe\myheel}}
118 %%
119
120 \def\emptybar{}
121
122 \def\defaultthinbar{\thinbar{\balkheight}}
123 \def\defaultthickbar{\thickbar{\balkheight}}
124 %? what-s wrong with rightalign?
125 \def\repeatstopbar{\hss\rightalign{\repeatcolon\hskip2\smallspace\defaultthinbar\hskip\smallspace\defaultthickbar}}
126 \def\repeatstartbar{\hbox{\defaultthickbar\kern\smallspace\defaultthinbar\kern2\smallspace\repeatcolon}}
127 \def\repeatstopstart{\hbox{\repeatcolon\kern2\smallspace\defaultthinbar\kern\smallspace\defaultthickbar\kern\smallspace\defaultthickbar\kern\smallspace\defaultthinbar\kern2\smallspace\repeatcolon}}
128
129 %compatibility
130 \def\repeatbar{\repeatstopbar}
131 \def\startrepeat{\repeatstartbar}
132 \def\repeatbarstartrepeat{\repeatstopstart}
133
134
135
136 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
137 % parametric symbols
138 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
139
140 \def\doublebar#1{\hbox{\thinbar{#1}\hskip\smallspace\thinbar{#1}}}
141 \def\thinbar#1{\vrule height #1 width 1.6\staffrulethickness} % TODO parametric.
142 \def\thickbar#1{\vrule height #1 width 2\smallspace}
143 \def\maatstreep#1{\thinbar{#1}}
144 \def\startbar#1{\leftalign{\thickbar{#1}\kern\smallspace\thinbar{#1}}}
145 \def\finishbar#1{\rightalign{\thinbar{#1}\kern\smallspace\thickbar{#1}}}
146
147 \def\pianobrace#1{{\musicdraw\char#1}}
148 \def\slurcharh#1{{\slurhfont\char#1}}
149 \def\slurcharu#1{{\slurufont\char#1}}
150 \def\slurchard#1{{\slurdfont\char#1}}
151 \def\hslurcharh#1{{\hslurhfont\char#1}}
152 \def\hslurcharu#1{{\hslurufont\char#1}}
153 \def\hslurchard#1{{\hslurdfont\char#1}}
154 % stacked numbers
155 \def\generalmeter#1#2{\botalign{\vbox to0.5\balkheight{\vss \meterfont#1}%
156         \nointerlineskip
157         \vbox to 0.5\balkheight{\vss\meterfont #2}}}
158
159 % stacked horizontal lines 
160 \def\lines#1#2#3{%
161  \vbox{\kern-\interstaffrule
162         \n=0\nointerlineskip%
163         \loop\ifnum\n<#1\advance\n by1%
164                 \kern\interstaffrule
165                 \nointerlineskip
166                 \vbox to 0pt{\hrule height #3 width#2%
167                         \vss}\nointerlineskip
168                 \repeat
169         }}
170
171 %%
172 % Ugh. Need to redo this. Wish we had PS.
173 %
174 \def\toplines#1{ % why space needed here?
175         \topalign{\hbox{\kern-\notewidth\lines{#1}{1.6\notewidth}{1.6\staffrulethickness}}}}
176
177 \def\botlines#1{ % idem ditto
178         \botalign{\hbox{\kern-\notewidth\lines{#1}{1.6\notewidth}{1.6\staffrulethickness}}}}
179
180 %
181 % a staffsymbol with #1 lines, width #2
182 % bottom at baseline
183 \def\linestafsym#1#2{\leftalign{\botalign{\lines{#1}{#2}{\staffrulethickness}}}}
184
185 \def\stem#1#2{\vrule height#2 depth-#1}
186
187 \def\placebox#1#2#3{%
188         \botalign{\hbox{\raise #1\leftalign{\kern #2{}#3}}}%
189 }
190
191
192 \def\beamslope#1#2{{\count0=#2\advance\count0 by#1\musicfnt\char\count0}}
193 \def\brace#1{\count0=148\advance\count0 by #1\musicdraw\char\count0}
194 \def\crescendosym#1{\count0=84\advance\count0 by #1\musicdraw\char\count0}
195 \def\decrescendosym#1{\count0=116\advance\count0 by #1\musicdraw\char\count0}
196 \def\rulesym#1#2{\vrule height #1 width #2}
197 \def\settext#1{\normaltextfont #1}
198 \def\setitalic#1{\italicfont #1}
199 \def\setdynamic#1{\dynfont #1}
200
201 % the interline symbol. Redefine to remove it.
202 \def\defaultlineseparator{\vbox{\mussepline\vskip -5pt\mussepline}}
203 \def\lineseparator{\defaultlineseparator}
204 \def\beauty{%
205         \par\vskip 10pt plus 30pt minus 10pt\par
206         \hskip -5pt\lineseparator
207         \par\vskip 10pt plus 30pt minus 10pt\par
208 }
209
210
211 \def\interscoreline{\vskip 16pt}
212         
213 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
214 % big fat marks, if errors are detected.
215 \def\columnerrormark{\placebox{-5pt}{0pt}{\bf C!}}
216 \def\scorelineerrormark{\placebox{0pt}{-10pt}{\bf L!}}
217 \def\unknown{{\bf u}}
218
219 \def\postheader{}
220 \ifundefined{documentclass}
221         \footline={\ifnum\pageno=1
222         {\smalltextfont\mudelacopyright\hfil \LilyIdString
223         }\else{\hfil\the\pageno\hfil}\fi
224 }\else
225         %% FIXME
226         \def\ps@plain{
227                 \renewcommand{\@oddhead}{}%
228                 \renewcommand{\@evenfoot}{}%
229                 \renewcommand{\@evenhead}{}%
230                 \renewcommand{\@oddfoot}{\ifnum\thepage=1
231         {\hfil \LilyIdString
232         }\else{foo\hfil\the\pageno\hfil}\fi}}
233         \def\ps@empty{
234                 \renewcommand{\@oddhead}{}%
235                 \renewcommand{\@evenfoot}{}%
236                 \renewcommand{\@evenhead}{}%
237                 \renewcommand{\@oddfoot}{\ifnum\thepage=1
238         {\hfil \LilyIdString
239         }\else{foo\hfil\the\pageno\hfil}\fi}}
240 \fi