2 \documentclass[a4paper, 12pt]{article}
4 \usepackage{t1enc,isolatin1}
6 %\usepackage[dvips]{graphicx}
7 \usepackage[rflt]{floatflt}
8 %\usepackage{showframe}
10 \def\postMudelaExample{\setlength{\parindent}{3.25ex}}
11 \title{Mudela-book tutorial}
17 \section{Introduction}
19 Mudela-book is a script that process your \LaTeX~file and with great
20 help from GNU LilyPond it translates blocks of mudela code it finds
21 inside \verb|mudela| environments to tex or eps graphics. It then
22 creates a new file that can be sendt through \LaTeX~to create a .dvi
23 file with lines of music integrated with text.
25 Mudela-book will do its best to try to align the music to the left and
26 right margins. Currently the most used papersizes and one- and
27 twocolumn mode is supported, but if you use the geometry-package from
28 \LaTeX~or change the margins things will break.
30 This document assumes you have basic knowledge of GNU LilyPond and
31 \LaTeX. If the authors not-so-good english irritates you, please
34 So what does this look like? Well, here is an example:
35 \begin[veryverbatim, intertext="produces this music:"]{mudela}
39 [e16( g b c a g][e a b d] | )e2 d,8 |
40 [e16( g b c a g][e a b d] | )b2 [a16( f] |
41 [e a b d] )e4 c8 | [es16( bes a as g es][d c b! )g] |
42 [f( a b d b a][f a b d] | )e2
46 If you are lucky, the above example show a nice feature of LilyPond
47 and \LaTeX. Since LilyPond can output the music as \TeX~graphics,
48 \LaTeX~can insert pagebreaks between the lines of music.
50 Notice that there is no \verb|\paper| statement in the example
51 above. Mudela-book will insert some code for you that defines the
52 linewidth and the font to use. If you don't want to change the default,
53 there is no need to put an empty \verb|\paper{}| inside the \verb|\score|.
54 In the example above, something like
55 this might be inserted before your code:
58 \paper{ \paper_sixteen
60 castingalgorithm = \Gourlay;
63 The actual values for linewidth will differ depending on papersize and
64 number of columns. Also, if you use a different fontsize for the
65 music, another file than \verb|paper16.ly| will be included.
67 If you want to make the music not so wide, you can insert a
68 \verb|\paper| statement that set the linewidth:
70 \begin[veryverbatim, intertext="produces this music:"]{mudela}
74 [e16( g b c a g][e a b d] | )e2 d,8 |
75 [e16( g b c a g][e a b d] | )b2 [a16( f] |
76 [e a b d] )e4 c8 | [es16( bes a as g es][d c b! )g] |
77 [f( a b d b a][f a b d] | )e2
79 \paper{linewidth = 10.\cm;}
83 Very often, if you mix music and text, the music is often only a
84 few notes or at most a few bars. This music should be as short as
85 possible and not stretched to be aligned to the right margin.
87 If you only write voice-contents in the mudela block, mudela-book
88 will set the \verb|linewidth| variable to -1, so Lilypond
89 will make the music as short as possible but without breaking the
90 line. Here is a well know harmonic progression:
91 \begin[veryverbatim, intertext="produce a well known harmonic progression:"]{mudela}
92 <c' e g> <b d g> <c2 e g>
95 If you want to place music examples in the text,
97 <c' e g> <b d g> <c2 e g>
99 , you can use the \verb|eps| option. This will create the music as
100 eps graphics and include it into the document with the
101 \verb|\includegraphics| command.
103 The code used look like this:
106 <c' e g> <b d g> <c2 e g>
110 You can also use the \verb|eps| option if the block is a complete
111 mudela source. This 5 cm long empty line,
115 \paper{ linewidth = 5.\cm;}
118 was created with this code:
123 \paper{ linewidth = 5.\cm;}
128 To avoid that \LaTeX~places the music on a line of its one, there should
129 be no empty lines between the normal text and the mudela
132 You can also use \verb|mudelafile| (on a separate line, FIXME), to
133 include another file. Files with name ending with \verb|.sly|
135 \mudelafile{testje.fly}
137 \section{Fontsize options}
138 You can use all lilypond fontsizes in mudela-book.
139 % LONG line just to test multiple \mudela on one line
140 The default 16pt fontsize, \mudela{<c' e g>}, is probably to big to be included in the middle of the text. 11pt, \mudela[11pt]{<c' e g>} or 13pt, \mudela[13pt]{<c' e g>} is probably better.
141 The code can look like this:
143 \begin[13pt, eps]{mudela}
148 The following options set the fontsize:
151 \begin[11pt, eps]{mudela}
153 r16 [c d e][f d e c] [g'8 c][b-\prall c] |
154 [d16 g, a b][c a b g][d'8 g f-\prall g]
158 \begin[13pt, eps]{mudela}
160 r16 [c d e][f d e c] [g'8 c][b-\prall c] |
161 [d16 g, a b][c a b g][d'8 g f-\prall g]
165 \begin[16pt, eps]{mudela}
167 r16 [c d e][f d e c] [g'8 c][b-\prall c] |
168 [d16 g, a b][c a b g][d'8 g f-\prall g]
172 \begin[20pt, eps]{mudela}
174 r16 [c d e][f d e c] [g'8 c][b-\prall c] |
175 [d16 g, a b][c a b g][d'8 g f-\prall g]
179 \begin[26pt, eps]{mudela}
181 r16 [c d e][f d e c] [g'8 c][b-\prall c] |
182 [d16 g, a b][c a b g][d'8 g f-\prall g]
187 \section{User defined commands}
188 There is an even shorter way to write small musical fragments. This
189 triad, \mudela{<c' e g>}, was created with this code:
190 \verb|\mudela{<c' e g>}|
192 Mudela-book defines the \verb|\mudela| command, and let you define
193 your own commands in a file specified by
194 the command line option \verb|--initfile=filename|. The format for the
195 file is a definition of a python dictionary:
199 \begin[eps \fontoptions]{mudela}
204 \begin[eps \fontoptions]{mudela}
206 \context RhythmicStaff{
207 \notes{\stemup \maininput}
209 \paper{linewidth = -1.\cm;}
215 The above code show how \verb|\mudela| could have been defined, and
216 also defines a new command \verb|mudelaRhythm|. Notice that you can
217 send fontsize options to the defined commands.
218 \verb|\mudelaRhythm[11pt]{c4 c8 [c16 c] c4 c}| produce this music:
219 \begin[eps, 11pt]{mudela}
221 \context RhythmicStaff{
222 \notes{ \stemup c4 r8 [c16 c] c4 c }
224 \paper{linewidth = -1.\cm;}
228 \section{More options}
230 \item The \verb|singleline| option set \verb|linewidth| to -1.0.
231 \item The \verb|multiline| option set \verb|linewidth| to a value letting
232 the music be aligned to the right margin. The music can span several
236 \section{Just in case...}
237 The options \verb|fragment| and \verb|nonfragment| will override
238 mudela-book when it scans the mudela code to see if it is voice
239 contents or complete code. This might be useful if mudela-book choose
242 Since there is no finder's fee which doubles every year, there is no
243 need to wait for the price money to grow. So send a bug report today
244 if you need this one of these options.
247 This was all options to \verb|\begin|. The rest of the{mudela}
248 document will show some ways you can use mudela in
249 \LaTeX~documents. It will also act as a simple test-suite for
253 \begin[eps, 11pt]{mudela}
254 \relative c'' {\key c \minor; r4 [g8 g g] es2}
256 }can place \verb|eps| mudela in footnotes\footnote{
258 \begin[eps, 11pt]{mudela}
259 \relative c'' {\key c \minor;r4 [g8 g g] es2}
262 and marginspars just as any other included eps graphics.
264 \begin{floatingfigure}[r]{7cm}
269 r4-\fermata [b16-.( )b-.] [f'8-- dis16-.( )dis-. gis8--]
270 [f16-.( )f-. dis8-- gis16-.( )gis-.] cis4.-\fermata |
272 r4.-\fermata [cis,16 cis g'8 f16 f b8][g16 g f8 b16 b] dis4.-\fermata
274 \paper{linewidth = 7.\cm;}
279 To the right you can see some bars from the trumpet fanfara from the
280 beginning of the fantastic street opera ``Houdini the Great'', by the
281 danish composer Andy Pape. The music is put inside a
282 \verb|floatingfigure| environment, and the music will be aligned by
283 the right marging if you set floatingfigure width and mudela linewidth
284 to the same value. The code looks like this:
286 \verb|\begin{floatingfigure}{7cm}|
287 \begin[verbatim]{mudela}
291 r4.-\fermata [b16-.( )b-.] [f'8-- dis16-.( )dis-. gis8--]
292 [f16-.( )f-. dis8-- gis16-.( )gis-.] cis8.-\fermata |
294 r4.-\fermata [cis,16 cis g'8 f16 f b8]
295 [g16 g f8 b16 b] dis4.-\fermata
297 \paper{linewidth = 7.\cm;}
300 \verb|\end{floatingfigure}|
302 \twocolumn[\large The following is written in two columns just to show
303 what mudela-book can do..\normalsize]
305 Tabulars is also nice. Here you have a chance to learn the norwegian
306 names of some triads:
309 \begin{tabular}{|l|l|}
313 \begin[eps, fragment]{mudela}
336 If you have a lot of small music examples
337 like this in the middle of your text, you might get a nicer look by
338 using ``double'' line spacing. Put the \verb|\linespread{1.6}| command
339 into the preamble of your document. Then the line spacing will not be
340 increased between the lines where you have music printed with the
343 Since the version number is quite low, you should be careful not to
344 mix braces that belongs to mudela-book and \LaTeX~on the same
345 line. The following code will probably break:
348 \footnote{\begin{mudela}
349 \relative c''{ \key es; r8 [g g g] es2}
352 Mudela-book does know about \verb|\onecolumn| and \verb|\twocolumn|.
353 So the music will be adjusted to the new linewith:
354 \begin[veryverbatim, intertext="produces"]{mudela}
356 \notes\relative c'{c d e f | g2 g | a4 a a a | g1 |
357 f4 f f f | e2 e | d4 d d d | c1}
361 Verbatim environments will also ignore the page margins. That is
362 a feature of \LaTeX. (But you usually put things inside a verbatim
363 environment when you don't want \LaTeX~to do any linebreaking)