]> git.donarmstrong.com Git - lilypond.git/blob - tex/lilyponddefs.tex
release: 1.1.44
[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{mudelatagline}
23         \def\mudelatagline{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 % mudela-book don't like this:
48 %\parindent=0pt
49 \newdimen\smallspace
50 \newdimen\interlinedist
51
52 \newdimen\stemthickness
53 \newcount\n                     %duh. meaningful identifiers.
54 \newdimen\staffheight
55 \newdimen\notewidth
56 \newdimen\noteheight
57 \newdimen\stafflinethickness
58 \newdimen\interstaffline
59 \newdimen\dist
60
61 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
62 % set fonts and primary dimensions
63 % ugh
64
65 \def\cmrtwenty{
66         \font\smalltextfont=cmr8
67         \font\textmusic=cmmi12
68 }
69
70 \def\cmrsixteen{
71         \font\smalltextfont=cmr6
72         \font\textmusic=cmmi10
73         }
74 \def\cmrthirteen{
75         \font\smalltextfont=cmr6
76         \font\textmusic=cmmi9
77         }
78 \def\cmreleven{
79         \font\smalltextfont=cmr5
80         \font\textmusic=cmmi8
81         }
82
83 %%%%%%%
84 %
85 \def\musixtwentydefs{
86       \twentyfonts
87       \csname cmrtwenty\texsuffix\endcsname
88       \musixcalc
89 }
90
91 \def\musixsixteendefs{
92         \sixteenfonts
93         \csname cmrsixteen\texsuffix\endcsname
94         \musixcalc
95         }
96 \def\musixtwentysixdefs{
97       \csname cmrtwentysix\texsuffix\endcsname
98           \twentysixfonts
99          \musixcalc
100         }
101 \def\musixthirteendefs{
102         \thirteenfonts
103         \csname cmrthirteen\texsuffix\endcsname
104        \musixcalc
105 }
106 \def\musixelevendefs{
107         \csname cmreleven\texsuffix\endcsname
108         \elevenfonts
109         \musixcalc
110 }
111
112 \def\textsharp{\raise.4ex\hbox{\textmusic\char"5D}}
113 \def\textnatural{\raise.4ex\hbox{\textmusic\char"5C}}
114 \def\textflat{\raise.2ex\hbox{\textmusic\char"5B}}
115
116
117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
118 % do derivative calcs
119
120 % this has to be synced with the font definition
121 \def\musixcalc{
122         \staffheight=\mudelapaperbarsize pt
123
124         % ugh.  Can extract ex dim from TFM
125         \interlinedist=\staffheight 
126         \divide\interlinedist by 4
127         \notewidth=\mudelapapernotewidth pt
128
129         \smallspace=.3\interlinedist
130         \interstaffline=\staffheight
131         \divide\interstaffline by 4
132         \stafflinethickness=\mudelapaperrulethickness pt
133         \stemthickness=\stafflinethickness
134 }
135
136
137
138 % stacked horizontal lines 
139 \def\interscoreline{\vskip 16pt}
140
141 % big fat marks, if errors are detected.
142 \def\columnerrormark{\placebox{-5pt}{0pt}{\bf C!}}
143 \def\scorelineerrormark{\placebox{0pt}{-10pt}{\bf L!}}
144 \def\errormark{{\bf E!}}
145 \def\unknown{%
146   %{\bf u} %FIXME
147 }
148
149 \input fetdefs
150
151
152 % ugh
153 % see e.g. input/test/beam-pos.ly
154 %
155 % something's wrong with the aligment; sometimes all symbols
156 % look to be placed a bit too high (there's an ugly fix for
157 % the staccato-dot in script.cc)
158 % but this varies from line to line: it seems that xdvi
159 % does some rounding; i can't really check this from screen on i
160 % 600x600 res.
161 %
162 \def\rulesym#1#2{\dimen0=#1     %obsolete
163         \vrule height .5\dimen0 depth .5\dimen0 width #2}
164 \def\shiftedrulesym#1#2{\dimen0=#1%
165         \vrule height .7\dimen0 depth .3\dimen0 width #2}
166 \def\tinyrulesym#1#2{\dimen0=#1%
167         \vrule height .1\dimen0 depth .1\dimen0 width #2}
168 %would be nice for checking alignment
169 \def\openrulesym#1#2{\dimen0=#1%
170         \vbox to \dimen0{\vss%
171         \hbox{\vrule height .1\dimen0 width #2}%
172         \hbox{\vrule height .2\dimen0 width 0pt}%
173         \hbox{\vrule height .4\dimen0 width #2}%
174         \hbox{\vrule height .2\dimen0 width 0pt}%
175         \hbox{\vrule height .1\dimen0 width #2}%
176         \vss}}
177 %\let\rulesym\shiftedrulesym
178 %\let\rulesym\tinyrulesym
179 %\let\rulesym\openrulesym
180
181 % the interline symbol. Redefine to remove it.
182 \def\defaultlineseparator{\vbox{\mussepline\vskip -5pt\mussepline}}
183 \def\lineseparator{\defaultlineseparator}
184 \def\beauty{%
185         \par\vskip 10pt plus 30pt minus 10pt\par
186         \hskip -5pt\lineseparator
187         \par\vskip 10pt plus 30pt minus 10pt\par
188 }
189
190
191 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
192 \def\postheader{}
193
194 %
195 % macros suck. \ifundefined{nolilyfooter} gives wierd errors from time
196 %        to time.
197 %
198
199 %
200 % Warning: the order is conceptually weird.  It says:
201
202 % if not defined (``nolilyfooter''):
203 %    do_footer ()
204 % else 
205 %    dont_do_footer ()
206 %
207 \ifx\csname nolilyfooter\endcsname\relax
208         \message{[footer defined]}%
209         \csname lilyfooter\texsuffix\endcsname%
210 \else
211         \message{[footer empty]}
212         \csname%
213         nolilyfooter\texsuffix\endcsname
214 \fi