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