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