]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/mudela-book.tely
release: 1.2.12
[lilypond.git] / Documentation / user / mudela-book.tely
1 \input texinfo @c -*-texinfo-*-
2 @setfilename reference-manual.info
3 @settitle Reference Manual
4
5 @node Top, , , (dir)
6 @top
7
8
9 @section Introduction
10
11 [TODO: THIS MANUAL IS OUTDATED. FIXME.]
12
13 Mudela-book is a script that process your \LaTeX file and with great
14 help from GNU LilyPond it translates blocks of mudela code it finds
15 inside @code{mudela} environments to tex or eps graphics. It then
16 creates a new file that can be sent through \LaTeX to create a
17 @file{.dvi} file with lines of music integrated with text.
18
19 Mudela-book will do its best to try to align the music to the left and
20 right margins. Currently the most used papersizes and one- and
21 twocolumn mode is supported, but if you use the geometry-package from
22 LaTeX or change the margins things will break.
23
24 This document assumes you have basic knowledge of GNU LilyPond and
25 LaTeX.
26
27 So what does this look like? Well, here is an example:
28 @mudela[veryverbatim, intertext="produces this music:"]
29 \score{
30   \notes\relative c'{
31     \time 5/8;
32     [e16( g b c a g][e a b d] | )e2 d,8 |
33     [e16( g b c a g][e a b d] | )b2 [a16( f] |
34     [e a b d] )e4 c8 | [es16( bes a as g es][d c b! )g] |
35     [f( a b d b a][f a b d] | )e2
36   }
37 }
38 @end mudela
39 If you are lucky, the above example show a nice feature of LilyPond
40 and LaTeX. Since LilyPond can output the music as \TeX graphics,
41 LaTeX can insert pagebreaks between the lines of music.
42
43 Notice that there is no @code{\paper} statement in the example
44 above. Mudela-book will insert some code for you that defines the
45 linewidth and the font to use. If you don't want to change the default, 
46 there is no need to put an empty @code{\paper@{@}} inside the @code{\score}.
47 In the example above, something like
48 this might be inserted before your code:
49 @example
50 \include "paper16.ly"
51 \paper@{ \paper_sixteen
52     linewidth = 390.\pt;
53     castingalgorithm = \Gourlay;
54 @}
55 @end example
56 The actual values for linewidth will differ depending on papersize and
57 number of columns. Also, if you use a different fontsize for the
58 music, another file than @code{paper16.ly} will be included.
59
60 If you want to make the music not so wide, you can insert a
61 @code{\paper} statement that set the linewidth:
62
63 @mudela[veryverbatim, intertext="produces this music:"]
64 \score{
65   \notes\relative c'{
66     \time 5/8;
67     [e16( g b c a g][e a b d] | )e2 d,8 |
68     [e16( g b c a g][e a b d] | )b2 [a16( f] |
69     [e a b d] )e4 c8 | [es16( bes a as g es][d c b! )g] |
70     [f( a b d b a][f a b d] | )e2
71   }
72   \paper{linewidth = 10.\cm;}
73 }
74 @end mudela
75
76 Very often, if you mix music and text, the music is often only a 
77 few notes or at most a few bars. This music should be as short as
78 possible and not stretched to be aligned to the right margin.
79
80 If you only write voice-contents in the mudela block, mudela-book 
81 will set the @code{linewidth} variable to -1, so Lilypond
82 will make the music as short as possible but without breaking the
83 line. Here is a well know harmonic progression:
84 @mudela[veryverbatim, intertext="produce a well known harmonic progression:"]
85   <c' e g> <b d g> <c2 e g>
86 @end mudela
87
88 If you want to place music examples in the text,
89 @mudela[eps]
90   <c' e g> <b d g> <c2 e g>
91 @end mudela
92 , you can use the @code{eps} option. This will create the music as
93 eps graphics and include it into the document with the 
94 @code{\includegraphics} command.
95
96 The code used look like this:
97 @example
98 @mudela[eps]
99   <c' e g> <b d g> <c2 e g>
100 @end mudela
101 @end example
102
103 You can also use the @code{eps} option if the block is a complete
104 mudela source. This 5 cm long empty line, 
105 @mudela[eps]
106 \score{
107   \notes{s}
108   \paper{ linewidth = 5.\cm;}
109 }
110 @end mudela
111 was created with this code:
112 @example
113 @mudela[eps]
114 \score{
115   \notes{s}
116   \paper{ linewidth = 5.\cm;}
117 }
118 @end mudela
119 @end example
120
121 To avoid that LaTeX places the music on a line of its one, there should
122 be no empty lines between the normal text and the mudela
123 environment. 
124
125 You can also use @code{mudelafile} (on a separate line, FIXME), to
126 include another file. Files with name ending with @code{.sly}
127
128 @section Fontsize options You can use all lilypond fontsizes in
129 mudela-book.  The default 16pt fontsize is probably to big to be
130 included in the middle of the text, 11pt or 13pt is probably better.
131
132 The code can look like this:
133 @example
134 @mudela[13pt, eps]
135 <c' e g>
136 @end mudela
137 @end example
138
139 The following options set the fontsize:
140 @itemize
141 @item @code{11pt}
142 @mudela[11pt, eps]
143   \relative c'{
144     r16 [c d e][f d e c] [g'8 c][b-\prall c] |
145     [d16 g, a b][c a b g][d'8 g f-\prall g]
146   }
147 @end mudela
148 @item @code{13pt}
149 @mudela[13pt, eps]
150   \relative c'{
151     r16 [c d e][f d e c] [g'8 c][b-\prall c] |
152     [d16 g, a b][c a b g][d'8 g f-\prall g]
153   }
154 @end mudela
155 @item @code{16pt}
156 @mudela[16pt, eps]
157   \relative c'{
158     r16 [c d e][f d e c] [g'8 c][b-\prall c] |
159     [d16 g, a b][c a b g][d'8 g f-\prall g]
160   }
161 @end mudela
162 @item @code{20pt}
163 @mudela[20pt, eps]
164   \relative c'{
165     r16 [c d e][f d e c] [g'8 c][b-\prall c] |
166     [d16 g, a b][c a b g][d'8 g f-\prall g]
167   }
168 @end mudela
169 @item @code{26pt}
170 @mudela[26pt, eps]
171   \relative c'{
172     r16 [c d e][f d e c] [g'8 c][b-\prall c] |
173     [d16 g, a b][c a b g][d'8 g f-\prall g]
174   }
175 @end mudela
176 @end itemize
177
178
179 @section More options
180 @itemize
181 @item The @code{singleline} option set @code{linewidth} to -1.0.
182 @item The @code{multiline} option set @code{linewidth} to a value letting
183 the music be aligned to the right margin. The music can span several
184 lines. 
185 @end itemize
186
187 @section Just in case...
188 The options @code{fragment} and @code{nonfragment} will override
189 mudela-book when it scans the mudela code to see if it is voice
190 contents or complete code. This might be useful if mudela-book choose
191 wrong. 
192
193 Since there is no finder's fee which doubles every year, there is no
194 need to wait for the price money to grow. So send a bug report today
195 if you need this one of these options.
196
197 @section Examples
198
199 This was all options to @code{\begin}. The rest of the mudela
200 document will show some ways you can use mudela in
201 LaTeX documents. It will also act as a simple test-suite for
202 mudela-book. You can place @code{eps} mudela in and marginspars just
203 as any other included eps graphics.
204
205 @mudela
206 \score{
207   \notes\relative c'{ 
208         \time 12/8;  
209         r4-\fermata [b16-.( )b-.] [f'8-- dis16-.( )dis-. gis8--]
210         [f16-.( )f-. dis8-- gis16-.( )gis-.] cis4.-\fermata |
211         
212         r4.-\fermata [cis,16 cis g'8 f16 f b8][g16 g f8 b16 b] dis4.-\fermata
213   }
214   \paper{linewidth = 7.\cm;}
215 }
216 @end mudela
217
218
219 To the right you can see some bars from the trumpet fanfara from the
220 beginning of the fantastic street opera ``Houdini the Great'', by the
221 Danish composer Andy Pape. The music is put inside a
222 @code{floatingfigure} environment, and the music will be aligned by
223 the right marging if you set floatingfigure width and mudela linewidth
224 to the same value. The code looks like this:
225
226 @mudela[verbatim]
227 \score{
228   \notes\relative c'{ 
229     \time 12/8;  
230     r4.-\fermata [b16-.( )b-.] [f'8-- dis16-.( )dis-. gis8--]
231     [f16-.( )f-. dis8-- gis16-.( )gis-.] cis8.-\fermata |
232         
233     r4.-\fermata [cis,16 cis g'8 f16 f b8]
234     [g16 g f8 b16 b] dis4.-\fermata
235   }
236   \paper{linewidth = 7.\cm;}
237 }
238 @end mudela
239
240 If you have a lot of small music examples like this in the middle of
241 your text, you might get a nicer look by using ``double'' line
242 spacing. Put the @code{\linespread@{1.6@}} command into the preamble of
243 your document. Then the line spacing will not be increased between the
244 lines where you have music printed with the smallest font size.
245
246 Mudela-book does know about @code{\onecolumn} and @code{\twocolumn}. 
247 So the music will be adjusted to the new linewith:
248
249 Verbatim environments will also ignore the page margins. That is
250 a feature of LaTeX. (But you usually put things inside a verbatim
251 environment when you don't want LaTeX to do any linebreaking)
252
253
254 @section Texinfo behavior
255
256 [TODO]
257
258 @section Invocation
259
260 @file{mudela-book} is a script that helps integrating mudela and
261 LaTeX.  mudela-book runs LilyPond on fragments of mudela in your
262 source file, and includes the results into document that can be
263 processed with LaTeX.  The result is a text document with formatted
264 music integrated.
265
266 Lilypond will by default create all output files in directory @file{out}.
267 The file to give to latex has ext @file{.latex}.
268
269 @strong{About the input}
270
271 If the file contains the ``block''
272
273 @example 
274
275         \begin@{mudela@}
276         CONTENTS
277         \end@{mudela@}
278  
279 @end example 
280
281 then LilyPond is run on CONTENTS.  mudela-book puts the result back,
282 surrounded by @code{\preMudelaExample} and @code{\postMudelaExample}
283 commands. @code{\preMudelaExample} and @code{posMudelaExample} is
284 defined to nothing by default, and the user can redefine them
285 to whatever he wants.
286
287 @code{\begin} takes the following options:
288
289 @table @samp
290 @item eps
291     the music is created as eps graphics that can be inserted in 
292     the middle of a text line, not only as a separate paragraph
293 @item verbatim
294     CONTENTS is copied into the TeX source enclosed in a verbatim block.
295 @item 11pt, 13pt, 16pt, 20pt, 26pt
296     set the fontsize to use for the music
297 @item singleline
298   linewidth = -1.
299 @item multiline
300   linewidth = textwidth
301 @item fragment
302 @item nonfragment
303     Override mudela-book autodetection of what type of code is in the
304     mudela block, voice contents or complete code.
305 @end table
306
307
308 @table @samp
309
310 @item --default-mudela-fontsize=??pt
311     Set the fontsize to use for mudela if no fontsize is given
312     as option.
313 @item --force-mudela-fontsize=??pt
314     Force all mudela to use this fontsize, overriding options
315     given to \begin@{mudela@}
316 @item --outname=FILE
317     The name of LaTeX file to output. If this option  is not given,
318 the output name derived from the input name.
319 @item --out-www=DIRECTORY
320     The name of the directory to output lilypond output and input to.
321     This must be a name; the subdirectory will be created in the cwd. [FIXME]
322 @item --help
323         Print a short help message
324 @item --dependencies
325         Write dependencies to out-www/filename.dep
326 @item --force-verbatim
327         Make all mudela verbatim.
328 @item --initfile=FILE
329         read command definitions from @file{FILE}
330 @end table
331
332
333
334 @file{mudela-book} is written in python 1.5, so you have to install
335 @uref{http://www.python.org,python}.
336
337
338
339 @section Bugs
340   
341 The LaTeX \includeonly@{...@} command is ignored.
342
343 Ignores almost all LaTeX commands that changes margins and linewidths.
344
345 @section Authors
346
347 @email{hanwen@@cs.uu.nl, Han-Wen Nienhuys}, @uref{http://www.cs.uu.nl/people/hanwen}
348
349 @email{tomato@@xoommail.com, Tom Cato Amundsen}
350
351
352 @bye
353
354
355
356
357
358