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 [TODO: THIS MANUAL IS OUTDATED. FIXME.]
21 Mudela-book is a script that process your \LaTeX~file and with great
22 help from GNU LilyPond it translates blocks of mudela code it finds
23 inside \verb|mudela| environments to tex or eps graphics. It then
24 creates a new file that can be sendt through \LaTeX~to create a .dvi
25 file with lines of music integrated with text.
27 Mudela-book will do its best to try to align the music to the left and
28 right margins. Currently the most used papersizes and one- and
29 twocolumn mode is supported, but if you use the geometry-package from
30 \LaTeX~or change the margins things will break.
32 This document assumes you have basic knowledge of GNU LilyPond and
33 \LaTeX. If the authors not-so-good english irritates you, please
36 So what does this look like? Well, here is an example:
37 \begin[veryverbatim, intertext="produces this music:"]{mudela}
41 [e16( g b c a g][e a b d] | )e2 d,8 |
42 [e16( g b c a g][e a b d] | )b2 [a16( f] |
43 [e a b d] )e4 c8 | [es16( bes a as g es][d c b! )g] |
44 [f( a b d b a][f a b d] | )e2
48 If you are lucky, the above example show a nice feature of LilyPond
49 and \LaTeX. Since LilyPond can output the music as \TeX~graphics,
50 \LaTeX~can insert pagebreaks between the lines of music.
52 Notice that there is no \verb|\paper| statement in the example
53 above. Mudela-book will insert some code for you that defines the
54 linewidth and the font to use. If you don't want to change the default,
55 there is no need to put an empty \verb|\paper{}| inside the \verb|\score|.
56 In the example above, something like
57 this might be inserted before your code:
60 \paper{ \paper_sixteen
62 castingalgorithm = \Gourlay;
65 The actual values for linewidth will differ depending on papersize and
66 number of columns. Also, if you use a different fontsize for the
67 music, another file than \verb|paper16.ly| will be included.
69 If you want to make the music not so wide, you can insert a
70 \verb|\paper| statement that set the linewidth:
72 \begin[veryverbatim, intertext="produces this music:"]{mudela}
76 [e16( g b c a g][e a b d] | )e2 d,8 |
77 [e16( g b c a g][e a b d] | )b2 [a16( f] |
78 [e a b d] )e4 c8 | [es16( bes a as g es][d c b! )g] |
79 [f( a b d b a][f a b d] | )e2
81 \paper{linewidth = 10.\cm;}
85 Very often, if you mix music and text, the music is often only a
86 few notes or at most a few bars. This music should be as short as
87 possible and not stretched to be aligned to the right margin.
89 If you only write voice-contents in the mudela block, mudela-book
90 will set the \verb|linewidth| variable to -1, so Lilypond
91 will make the music as short as possible but without breaking the
92 line. Here is a well know harmonic progression:
93 \begin[veryverbatim, intertext="produce a well known harmonic progression:"]{mudela}
94 <c' e g> <b d g> <c2 e g>
97 If you want to place music examples in the text,
99 <c' e g> <b d g> <c2 e g>
101 , you can use the \verb|eps| option. This will create the music as
102 eps graphics and include it into the document with the
103 \verb|\includegraphics| command.
105 The code used look like this:
108 <c' e g> <b d g> <c2 e g>
112 You can also use the \verb|eps| option if the block is a complete
113 mudela source. This 5 cm long empty line,
117 \paper{ linewidth = 5.\cm;}
120 was created with this code:
125 \paper{ linewidth = 5.\cm;}
130 To avoid that \LaTeX~places the music on a line of its one, there should
131 be no empty lines between the normal text and the mudela
134 You can also use \verb|mudelafile| (on a separate line, FIXME), to
135 include another file. Files with name ending with \verb|.sly|
137 \mudelafile{testje.fly}
139 \section{Fontsize options}
140 You can use all lilypond fontsizes in mudela-book.
141 % LONG line just to test multiple \mudela on one line
142 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.
143 The code can look like this:
145 \begin[13pt, eps]{mudela}
150 The following options set the fontsize:
153 \begin[11pt, eps]{mudela}
155 r16 [c d e][f d e c] [g'8 c][b-\prall c] |
156 [d16 g, a b][c a b g][d'8 g f-\prall g]
160 \begin[13pt, eps]{mudela}
162 r16 [c d e][f d e c] [g'8 c][b-\prall c] |
163 [d16 g, a b][c a b g][d'8 g f-\prall g]
167 \begin[16pt, eps]{mudela}
169 r16 [c d e][f d e c] [g'8 c][b-\prall c] |
170 [d16 g, a b][c a b g][d'8 g f-\prall g]
174 \begin[20pt, eps]{mudela}
176 r16 [c d e][f d e c] [g'8 c][b-\prall c] |
177 [d16 g, a b][c a b g][d'8 g f-\prall g]
181 \begin[26pt, eps]{mudela}
183 r16 [c d e][f d e c] [g'8 c][b-\prall c] |
184 [d16 g, a b][c a b g][d'8 g f-\prall g]
189 \section{User defined commands}
190 There is an even shorter way to write small musical fragments. This
191 triad, \mudela{<c' e g>}, was created with this code:
192 \verb|\mudela{<c' e g>}|
195 Mudela-book defines the \verb|\mudela| command, and let you define
196 your own commands in a file specified by
197 the command line option \verb|--initfile=filename|. The format for the
198 file is a definition of a python dictionary:
202 \begin[eps \fontoptions]{mudela}
207 \begin[eps \fontoptions]{mudela}
209 \context RhythmicStaff{
210 \notes{\stemup \maininput}
212 \paper{linewidth = -1.\cm;}
218 The above code show how \verb|\mudela| could have been defined, and
219 also defines a new command \verb|mudelaRhythm|. Notice that you can
220 send fontsize options to the defined commands.
221 \verb|\mudelaRhythm[11pt]{c4 c8 [c16 c] c4 c}| produce this music:
222 \begin[eps, 11pt]{mudela}
224 \context RhythmicStaff{
225 \notes{ \stemup c4 r8 [c16 c] c4 c }
227 \paper{linewidth = -1.\cm;}
232 \section{More options}
234 \item The \verb|singleline| option set \verb|linewidth| to -1.0.
235 \item The \verb|multiline| option set \verb|linewidth| to a value letting
236 the music be aligned to the right margin. The music can span several
240 \section{Just in case...}
241 The options \verb|fragment| and \verb|nonfragment| will override
242 mudela-book when it scans the mudela code to see if it is voice
243 contents or complete code. This might be useful if mudela-book choose
246 Since there is no finder's fee which doubles every year, there is no
247 need to wait for the price money to grow. So send a bug report today
248 if you need this one of these options.
251 This was all options to \verb|\begin|. The rest of the{mudela}
252 document will show some ways you can use mudela in
253 \LaTeX~documents. It will also act as a simple test-suite for
257 \begin[eps, 11pt]{mudela}
258 \relative c'' {\key c \minor; r4 [g8 g g] es2}
260 }can place \verb|eps| mudela in footnotes\footnote{
262 \begin[eps, 11pt]{mudela}
263 \relative c'' {\key c \minor;r4 [g8 g g] es2}
266 and marginspars just as any other included eps graphics.
268 \begin{floatingfigure}[r]{7cm}
273 r4-\fermata [b16-.( )b-.] [f'8-- dis16-.( )dis-. gis8--]
274 [f16-.( )f-. dis8-- gis16-.( )gis-.] cis4.-\fermata |
276 r4.-\fermata [cis,16 cis g'8 f16 f b8][g16 g f8 b16 b] dis4.-\fermata
278 \paper{linewidth = 7.\cm;}
283 To the right you can see some bars from the trumpet fanfara from the
284 beginning of the fantastic street opera ``Houdini the Great'', by the
285 danish composer Andy Pape. The music is put inside a
286 \verb|floatingfigure| environment, and the music will be aligned by
287 the right marging if you set floatingfigure width and mudela linewidth
288 to the same value. The code looks like this:
290 \verb|\begin{floatingfigure}{7cm}|
291 \begin[verbatim]{mudela}
295 r4.-\fermata [b16-.( )b-.] [f'8-- dis16-.( )dis-. gis8--]
296 [f16-.( )f-. dis8-- gis16-.( )gis-.] cis8.-\fermata |
298 r4.-\fermata [cis,16 cis g'8 f16 f b8]
299 [g16 g f8 b16 b] dis4.-\fermata
301 \paper{linewidth = 7.\cm;}
304 \verb|\end{floatingfigure}|
306 \twocolumn[\large The following is written in two columns just to show
307 what mudela-book can do..\normalsize]
309 Tabulars is also nice. Here you have a chance to learn the norwegian
310 names of some triads:
313 \begin{tabular}{|l|l|}
317 \begin[eps, fragment]{mudela}
340 If you have a lot of small music examples
341 like this in the middle of your text, you might get a nicer look by
342 using ``double'' line spacing. Put the \verb|\linespread{1.6}| command
343 into the preamble of your document. Then the line spacing will not be
344 increased between the lines where you have music printed with the
347 Since the version number is quite low, you should be careful not to
348 mix braces that belongs to mudela-book and \LaTeX~on the same
349 line. The following code will probably break:
352 \footnote{\begin{mudela}
353 \relative c''{ \key es; r8 [g g g] es2}
356 Mudela-book does know about \verb|\onecolumn| and \verb|\twocolumn|.
357 So the music will be adjusted to the new linewith:
358 \begin[veryverbatim, intertext="produces"]{mudela}
360 \notes\relative c'{c d e f | g2 g | a4 a a a | g1 |
361 f4 f f f | e2 e | d4 d d d | c1}
365 Verbatim environments will also ignore the page margins. That is
366 a feature of \LaTeX. (But you usually put things inside a verbatim
367 environment when you don't want \LaTeX~to do any linebreaking)