1 \documentclass[a4paper, 12pt]{article}
3 \usepackage{t1enc,isolatin1}
5 %\usepackage[dvips]{graphicx}
6 \usepackage[rflt]{floatflt}
7 %\usepackage{showframe}
9 \def\postMudelaExample{\setlength{\parindent}{1em}}
10 \title{Mudela-book tutorial}
15 \section{Introduction}
17 Mudela-book is a script that process your \LaTeX~file and with great
18 help from GNU LilyPond it translates blocks of mudela code it finds
19 inside \verb|mudela| environments to tex or eps graphics. It then
20 creates a new file that can be sendt through \LaTeX~to create a .dvi
21 file with lines of music integrated with text.
23 Mudela-book will do its best to try to align the music to the left and
24 right margins. Currently the most used papersizes and one- and
25 twocolumn mode is supported, but if you use the geometry-package from
26 \LaTeX~or change the margins things will break.
28 This document assumes you have basic knowledge of GNU LilyPond and
29 \LaTeX. If the authors not-so-good english irritates you, please
32 So what does this look like? Well, here is an example:
34 \begin{mudela}[verbatim]
38 [e16( g b c a g][e a b d] | )e2 d,8 |
39 [e16( g b c a g][e a b d] | )b2 [a16( f] |
40 [e a b d] )e4 c8 | [es16( bes a as g es][d c b! )g] |
41 [f( a b d b a][f a b d] | )e2
46 \noindent produces this music:
52 [e16( g b c a g][e a b d] | )e2 d,8 |
53 [e16( g b c a g][e a b d] | )b2 [a16( f] |
54 [e a b d] )e4 c8 | [es16( bes a as g es][d c b! )g] |
55 [f( a b d b a][f a b d] | )e2
60 If you are lucky, the above example show a nice feature of LilyPond
61 and \LaTeX. Since LilyPond can output the music as \TeX~graphics,
62 \LaTeX~can insert pagebreaks between the lines of music.
64 Notice that there is no \verb|\paper| statement in the example
65 above. Mudela-book will insert some code for you that defines the
66 linewidth and the font to use. If you don't want to change the default,
67 there is no need to put an empty \verb|\paper{}| inside the \verb|\score|.
68 In the example above, something like
69 this might be inserted before your code:
72 \paper{ \paper_sixteen
74 castingalgorithm = \Gourlay;
77 The actual values for linewidth will differ depending on papersize and
78 number of columns. Also, if you use a different fontsize for the
79 music, another file than \verb|paper16.ly| will be included.
81 If you want to make the music not so wide, you can insert a
82 \verb|\paper| statement that set the linewidth:
84 \begin{mudela}[verbatim]
88 [e16( g b c a g][e a b d] | )e2 d,8 |
89 [e16( g b c a g][e a b d] | )b2 [a16( f] |
90 [e a b d] )e4 c8 | [es16( bes a as g es][d c b! )g] |
91 [f( a b d b a][f a b d] | )e2
93 \paper{linewidth = 10.\cm;}
97 \noindent produces this music:
100 % dette er en kommentar
104 [e16( g b c a g][e a b d] | )e2 d,8 |
105 [e16( g b c a g][e a b d] | )b2 [a16( f] |
106 [e a b d] )e4 c8 | [es16( bes a as g es][d c b! )g] |
107 [f( a b d b a][f a b d] | )e2
109 \paper{linewidth = 10.\cm;}
113 Very often, if you mix music and text, the music is often only a
114 few notes or at most a few bars. This music should be as short as
115 possible and not stretched to be aligned to the right margin.
117 If you only write voice-contents in the mudela block, mudela-book
118 will set the \verb|linewidth| variable to -1, so Lilypond
119 will make the music as short as possible but without breaking the
120 line. Here is a well know harmonic progression:
122 % dette er en kommentar
123 <c' e' g'> <b d' g'> <c'2 e' g'>
125 \noindent that is made by this code:
126 \begin{mudela}[verbatim]
127 <c' e' g'> <b d' g'> <c'2 e' g'>
130 If you want to place music examples in the text,
132 <c' e' g'> <b d' g'> <c'2 e' g'>
134 , you can use the \verb|eps| option. This will create the music as
135 eps graphics and include it into the document with the
136 \verb|\includegraphics| command.
138 The code used look like this:
139 \begin{mudela}[eps, verbatim]
140 <c' e' g'> <b d' g'> <c'2 e' g'>
143 You can also use the \verb|eps| option if the block is a complete
144 mudela source. This 5 cm long empty line,
148 \paper{ linewidth = 5.\cm;}
151 was created with this code:
152 \begin{mudela}[eps, verbatim]
155 \paper{ linewidth = 5.\cm;}
158 To avoid that \LaTeX~places the music on a line of its one, there should
159 be no empty lines between the normal text and the mudela
162 \section{Fontsize options}
163 You can use all lilypond fontsizes in mudela-book.
164 % LONG line just to test multiple mudela on one line
165 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.
166 The code can look like this:
167 \begin{mudela}[13pt, eps, verbatim]
171 The following options set the fontsize:
174 \begin{mudela}[11pt, eps]
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{mudela}[13pt, eps]
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]
188 \begin{mudela}[16pt, eps]
190 r16 [c d e][f d e c] [g'8 c][b-\prall c] |
191 [d16 g, a b][c a b g][d'8 g f-\prall g]
195 \begin{mudela}[20pt, eps]
197 r16 [c d e][f d e c] [g'8 c][b-\prall c] |
198 [d16 g, a b][c a b g][d'8 g f-\prall g]
202 \begin{mudela}[26pt, eps]
204 r16 [c d e][f d e c] [g'8 c][b-\prall c] |
205 [d16 g, a b][c a b g][d'8 g f-\prall g]
210 \section{User defined commands}
211 There is an even shorter way to write small musical fragments. This
212 triad, \mudela{<c' e' g'>}, was created with this code:
213 \verb|\mudela{<c' e' g'>}|
215 Mudela-book defines the \verb|\mudela| command, and let you define
216 your own commands in a file specified by
217 the command line option \verb|--initfile=filename|. The format for the
218 file is a definition of a python dictionary:
219 % mudela-book should really respect \begin{verbatim}
221 \verb|{ 'mudela': r"""|
223 \verb|\begin|\verb|{mudela}[eps \fontoptions]|
227 \verb|\end|\verb|{mudela}|
231 \verb| 'mudelaRhythm': r"""|
233 \verb|\begin|\verb|{mudela}[eps \fontoptions]|
237 \notes{\stemup \maininput}
239 \paper{linewidth = -1.\cm;}
242 \verb|\end|\verb|{mudela}|
248 The above code show how \verb|\mudela| could have been defined, and
249 also defines a new command \verb|mudelaRhythm|. Notice that you can
250 send fontsize options to the defined commands.
251 \verb|\mudelaRhytm[11pt]{c4 c8 [c16 c] c4 c}| produce this music:
252 \begin{mudela}[eps, 11pt]
255 \notes{ \stemup c4 r8 [c16 c] c4 c }
257 \paper{linewidth = -1.\cm;}
261 \section{Just in case...}
262 The options \verb|fragment| and \verb|nonfragment| will override
263 mudela-book when it scans the mudela code to see if it is staff
264 contents or complete code. This might be useful if mudela-book choose
267 Since there is no finder's fee which doubles every year, there is no
268 need to wait for the price money to grow. So send a bug report today
269 if you need this one of this options.
272 This was all options to \verb|\begin{mudela}|. The rest of the
273 document will show some ways you can use mudela in
274 \LaTeX~documents. It will also act as a simple test-suite for
275 mudela-book. You \marginpar{
277 \begin{mudela}[eps, 11pt]
278 \relative c'' {\key c \minor; r4 [g8 g g] es2}
280 }can place \verb|eps| mudela in footnotes\footnote{
282 \begin{mudela}[eps, 11pt]
283 \relative c'' {\key c \minor;r4 [g8 g g] es2}
286 and marginspars just as any other included eps graphics.
288 \begin{floatingfigure}[r]{7cm}
293 r4-\fermata [b16-.( )b-.] [f'8-- dis16-.( )dis-. gis8--]
294 [f16-.( )f-. dis8-- gis16-.( )gis-.] cis4.-\fermata |
296 r4.-\fermata [cis,16 cis g'8 f16 f b8][g16 g f8 b16 b] dis4.-\fermata
298 \paper{linewidth = 7.\cm;}
303 To the right you can see some bars from the trumpet fanfara from the
304 beginning of the fantastic street opera ``Houdini the Great'', by the
305 danish composer Andy Pape. The music is put inside a
306 \verb|floatingfigure| environment, and the music will be aligned by
307 the right marging if you set floatingfigure width and mudela linewidth
308 to the same value. The code looks like this:
310 \verb|\begin{floatingfigure}{7cm}|
311 \begin{mudela}[verbatim]
315 r4.-\fermata [b16-.( )b-.] [f'8-- dis16-.( )dis-. gis8--]
316 [f16-.( )f-. dis8-- gis16-.( )gis-.] cis8.-\fermata |
318 r4.-\fermata [cis,16 cis g'8 f16 f b8]
319 [g16 g f8 b16 b] dis4.-\fermata
321 \paper{linewidth = 7.\cm;}
324 \verb|\end{floatingfigure}|
326 \twocolumn[\large The following is written in two columns just to show
327 what mudela-book can do..\normalsize]
329 Tabulars is also nice. Here you have a chance to learn the norwegian
330 names of some triads:
333 \begin{tabular}{|l|l|}
360 If you have a lot of small music examples
361 like this in the middle of your text, you might get a nicer look by
362 using ``double'' line spacing. Put the \verb|\linespread{1.6}| command
363 into the preamble of your document. Then the line spacing will not be
364 increased between the lines where you have music printed with the
367 Sinse the version number is quite low, you should be careful not to
368 mix braces that belongs to mudela-book and \LaTeX~on the same
369 line. The following code will probably break:
371 \verb|\footnote{\begin{mudela}|
373 \verb|\relative c''{ \key es; r8 [g g g] es2} |
377 Mudela-book does know about \verb|\onecolumn| and \verb|\twocolumn|.
378 So the music will be adjusted to the new linewith:
379 \begin{mudela}[verbatim]
381 \notes\relative c'{c d e f | g2 g | a4 a a a | g1 |
382 f4 f f f | e2 e | d4 d d d | c1}
388 \notes\relative c'{c d e f | g2 g | a4 a a a | g1 |
389 f4 f f f | e2 e | d4 d d d | c1}
393 Verbatim environments will also ignore the page margins. That is
394 a feature of \LaTeX. (But you usually put things inside a verbatim
395 environment when you don't want \LaTeX~to do any linebreaking)