]> git.donarmstrong.com Git - lilypond.git/blob - tex/lilyponddefs.tex
release: 1.0.14
[lilypond.git] / tex / lilyponddefs.tex
1 %%
2 %% include file for LilyPond
3 %%
4 %% this file defines various macros to accomodate lilypond output
5 %% 
6 %% let's not make par before endinput
7 %
8 % TeXbook ex 7.7
9 \def\ifundefined#1{\expandafter\ifx\csname#1\endcsname\relax}
10 %
11 % skip if included already
12 \def\SkipLilydefs{\endinput}
13 \ifundefined{EndLilyPondOutput}
14         \def\EndLilyPondOutput{\csname bye\endcsname}
15         \def\SkipLilydefs{}
16 \fi
17 \SkipLilydefs
18 %
19 \ifundefined{mudelacopyright}
20         \def\mudelacopyright{\copyright\ \number\year}
21 \fi
22 \ifundefined{LilyIdString}
23         \def\LilyIdString{Lily was here}
24 \fi
25 \ifundefined{documentclass}
26         \input lilypond-plaintex
27 \else
28         \input lilypond-latex
29 \fi
30
31 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32 % macros to shorten other definitions
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
34 \def\musicmathdef#1#2{\def#1{\musicmathchar{#2}}}
35 \def\musicmathchar#1{\musicmathfont\char#1}
36
37 \def\topalign#1{\vbox to 0pt{#1\vss}}
38 \def\botalign#1{\vbox to 0pt{\vss #1}}
39
40 \def\centeralign#1{\hbox to 0pt{\hss#1\hss}}
41 \def\leftalign#1{\hbox to 0pt{#1\hss}}
42 \def\rightalign#1{\hbox to 0pt{\hss#1}}
43
44
45 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
46 %% set up dimensions
47 \parindent=0pt
48 \newdimen\smallspace
49 \newdimen\interlinedist
50
51 \newdimen\stemthickness
52 \newcount\n                     %duh. meaningful identifiers.
53 \newdimen\staffheight
54 \newdimen\notewidth
55 \newdimen\noteheight
56 \newdimen\staffrulethickness
57 \newdimen\interstaffrule
58 \newdimen\dist
59
60 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61 % set fonts and primary dimensions
62 % ugh
63
64 \def\cmrtwenty{
65         \font\smalltextfont=cmr8
66         \font\textmusic=cmmi12
67 }
68
69 \def\cmrsixteen{
70         \font\smalltextfont=cmr6
71         \font\textmusic=cmmi10
72         }
73 \def\cmrthirteen{
74         \font\smalltextfont=cmr6
75         \font\textmusic=cmmi9
76         }
77 \def\cmreleven{
78         \font\smalltextfont=cmr5
79         \font\textmusic=cmmi8
80         }
81
82 %%%%%%%
83 %
84 \def\musixtwentydefs{
85       \twentyfonts
86       \csname cmrtwenty\texsuffix\endcsname
87       \musixcalc
88 }
89
90 \def\musixsixteendefs{
91         \sixteenfonts
92         \csname cmrsixteen\texsuffix\endcsname
93         \musixcalc
94         }
95 \def\musixtwentysixdefs{
96       \csname cmrtwentysix\texsuffix\endcsname
97           \twentysixfonts
98          \musixcalc
99         }
100 \def\musixthirteendefs{
101         \thirteenfonts
102         \csname cmrthirteen\texsuffix\endcsname
103        \musixcalc
104 }
105 \def\musixelevendefs{
106         \csname cmreleven\texsuffix\endcsname
107         \elevenfonts
108         \musixcalc
109 }
110
111 \def\textsharp{\raise.4ex\hbox{\textmusic\char"5D}}
112 \def\textnatural{\raise.4ex\hbox{\textmusic\char"5C}}
113 \def\textflat{\raise.2ex\hbox{\textmusic\char"5B}}
114
115
116 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
117 % do derivative calcs
118
119 % this has to be synced with the font definition
120 \def\musixcalc{
121         \staffheight=\mudelapaperbarsize pt
122
123         % ugh.  Can extract ex dim from TFM
124         \interlinedist=\staffheight 
125         \divide\interlinedist by 4
126         \notewidth=\mudelapapernotewidth pt
127
128         \smallspace=.3\interlinedist
129         \interstaffrule=\staffheight
130         \divide\interstaffrule by 4
131         \staffrulethickness=\mudelapaperrulethickness pt
132         \stemthickness=\staffrulethickness
133 }
134
135
136
137 % stacked horizontal lines 
138 \def\interscoreline{\vskip 16pt}
139 \def\setdynamic#1{\dynfont #1}
140 \def\setfinger#1{\fingerfont #1}
141 \def\setnumber#1{\fetanummer #1}
142 \def\setmark#1{\markfont #1}
143
144 % big fat marks, if errors are detected.
145 \def\columnerrormark{\placebox{-5pt}{0pt}{\bf C!}}
146 \def\scorelineerrormark{\placebox{0pt}{-10pt}{\bf L!}}
147 \def\errormark{{\bf E!}}
148 \def\unknown{%
149   %{\bf u} %FIXME
150 }
151
152 \input dyndefs
153 \input fetdefs
154
155
156
157 \def\emptybar{}
158
159 \def\defaultthinbar{\thinbar{\staffheight}}
160 \def\defaultthickbar{\thickbar{\staffheight}}
161 %? what-s wrong with rightalign?
162 \def\repeatstopbar{\rightalign{\repeatcolon\kern2\smallspace\defaultthinbar\kern\smallspace\defaultthickbar}}
163 \def\repeatstartbar{\hbox{\defaultthickbar\kern\smallspace\defaultthinbar\kern2\smallspace\repeatcolon}}
164 \def\repeatstopstart{\hbox{\repeatcolon\kern2\smallspace\defaultthickbar\kern\smallspace\defaultthickbar\kern2\smallspace\repeatcolon}}
165
166 %compatibility
167 %urg
168 \fetdef\repeatcolon{18}
169 \def\repeatbar{\repeatstopbar}
170 \def\startrepeat{\repeatstartbar}
171 \def\repeatbarstartrepeat{\repeatstopstart}
172
173 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
174 % parametric symbols
175 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
176
177 \def\doublebar#1{\hbox{\thinbar{#1}\hskip\smallspace\thinbar{#1}}}
178 \def\thinbar#1{\dimen0=#1%
179         \vrule height .5\dimen0 depth .5\dimen0 width 1.6\staffrulethickness} % TODO parametric.
180 \def\thickbar#1{\dimen0=#1%
181         \vrule height .5\dimen0 depth .5\dimen0 width 2\smallspace}
182 \def\maatstreep#1{\thinbar{#1}}
183 \def\startbar#1{\leftalign{\thickbar{#1}\kern\smallspace\thinbar{#1}}}
184 \def\finishbar#1{\rightalign{\thinbar{#1}\kern\smallspace\thickbar{#1}}}
185 \def\fatdoublebar#1{\hbox{\phantom{\repeatcolon\kern2\smallspace}\thickbar{#1}\kern\smallspace\thickbar{#1}}}
186
187
188
189 % ugh
190 % see e.g. input/test/beam-pos.ly
191 %
192 % something's wrong with the aligment; sometimes all symbols
193 % look to be placed a bit too high (there's an ugly fix for
194 % the staccato-dot in script.cc)
195 % but this varies from line to line: it seems that xdvi
196 % does some rounding; i can't really check this from screen on i
197 % 600x600 res.
198 %
199 \def\rulesym#1#2{\dimen0=#1%
200         \vrule height .5\dimen0 depth .5\dimen0 width #2}
201 \def\shiftedrulesym#1#2{\dimen0=#1%
202         \vrule height .7\dimen0 depth .3\dimen0 width #2}
203 \def\tinyrulesym#1#2{\dimen0=#1%
204         \vrule height .1\dimen0 depth .1\dimen0 width #2}
205 %would be nice for checking alignment
206 \def\openrulesym#1#2{\dimen0=#1%
207         \vbox to \dimen0{\vss%
208         \hbox{\vrule height .1\dimen0 width #2}%
209         \hbox{\vrule height .2\dimen0 width 0pt}%
210         \hbox{\vrule height .4\dimen0 width #2}%
211         \hbox{\vrule height .2\dimen0 width 0pt}%
212         \hbox{\vrule height .1\dimen0 width #2}%
213         \vss}}
214 %\let\rulesym\shiftedrulesym
215 %\let\rulesym\tinyrulesym
216 %\let\rulesym\openrulesym
217
218 % the interline symbol. Redefine to remove it.
219 \def\defaultlineseparator{\vbox{\mussepline\vskip -5pt\mussepline}}
220 \def\lineseparator{\defaultlineseparator}
221 \def\beauty{%
222         \par\vskip 10pt plus 30pt minus 10pt\par
223         \hskip -5pt\lineseparator
224         \par\vskip 10pt plus 30pt minus 10pt\par
225 }
226
227
228 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
229 \def\postheader{}
230
231 %
232 % macros suck. \ifundefined{nolilyfooter} gives wierd errors from time
233 %        to time.
234 %
235
236 %
237 % Warning: the order is conceptually weird.  It says:
238
239 % if not defined (``nolilyfooter''):
240 %    do_footer ()
241 % else 
242 %    dont_do_footer ()
243 %
244 \ifx\csname nolilyfooter\endcsname\relax
245         \message{[footer defined]}%
246         \csname lilyfooter\texsuffix\endcsname%
247 \else
248         \message{[footer empty]}
249         \csname%
250         nolilyfooter\texsuffix\endcsname
251 \fi