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