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 Mudela-book is a script that process your \LaTeX~file and with great
16 help from GNU LilyPond it translates blocks of mudela code it finds
17 inside \verb|mudela| environments to tex or eps graphics. It then
18 creates a new file that can be sendt through \LaTeX~to create a .dvi
19 file with lines of music integrated with text.
21 Mudela-book will do its best to try to align the music to the left and
22 right margins. Currently the most used papersizes and one- and
23 twocolumn mode is supported, but if you use the geometry-package from
24 \LaTeX~or change the margins things will break.
26 This document assumes you have basic knowledge of GNU LilyPond and
27 \LaTeX. If the authors not-so-good english irritates you, please
30 So what does this look like? Well, here is an example:
32 \begin{mudela}[verbatim]
36 [e16( g b c a g][e a b d] | )e2 d,8 |
37 [e16( g b c a g][e a b d] | )b2 [a16( f] |
38 [e a b d] )e4 c8 | [es16( bes a as g es][d c b! )g] |
39 [f( a b d b a][f a b d] | )e2
44 \noindent produces this music:
50 [e16( g b c a g][e a b d] | )e2 d,8 |
51 [e16( g b c a g][e a b d] | )b2 [a16( f] |
52 [e a b d] )e4 c8 | [es16( bes a as g es][d c b! )g] |
53 [f( a b d b a][f a b d] | )e2
58 If you are lucky, the above example show a nice feature of LilyPond
59 and \LaTeX. Since LilyPond can output the music as \TeX~graphics,
60 \LaTeX~can insert pagebreaks between the lines of music.
62 Notice that there is no \verb|\paper| statement in the example
63 above. Mudela-book will insert some code for you that defines the
64 linewidth and the font to use. If you don't want to change the default,
65 there is no need to put an empty \verb|\paper{}| inside the \verb|\score|.
66 In the example above, something like
67 this might be inserted before your code:
70 \paper{ \paper_sixteen
72 castingalgorithm = \Gourlay;
75 The actual values for linewidth will differ depending on papersize and
76 number of columns. Also, if you use a different fontsize for the
77 music, another file than \verb|paper16.ly| will be included.
79 If you want to make the music not so wide, you can insert a
80 \verb|\paper| statement that set the linewidth:
82 \begin{mudela}[verbatim]
86 [e16( g b c a g][e a b d] | )e2 d,8 |
87 [e16( g b c a g][e a b d] | )b2 [a16( f] |
88 [e a b d] )e4 c8 | [es16( bes a as g es][d c b! )g] |
89 [f( a b d b a][f a b d] | )e2
91 \paper{linewidth = 10.\cm;}
95 \noindent produces this music:
98 % dette er en kommentar
102 [e16( g b c a g][e a b d] | )e2 d,8 |
103 [e16( g b c a g][e a b d] | )b2 [a16( f] |
104 [e a b d] )e4 c8 | [es16( bes a as g es][d c b! )g] |
105 [f( a b d b a][f a b d] | )e2
107 \paper{linewidth = 10.\cm;}
111 Very often, if you mix music and text, the music is often only a
112 few notes or at most a few bars. This music should be as short as
113 possible and not stretched to be aligned to the right margin.
115 If you only write voice-contents in the mudela block, mudela-book
116 will set the \verb|linewidth| variable to -1, so Lilypond
117 will make the music as short as possible but without breaking the
118 line. Here is a well know harmonic progression:
120 % dette er en kommentar
121 <c' e' g'> <b d' g'> <c'2 e' g'>
123 \noindent that is made by this code:
124 \begin{mudela}[verbatim]
125 <c' e' g'> <b d' g'> <c'2 e' g'>
128 If you want to place music examples in the text,
130 <c' e' g'> <b d' g'> <c'2 e' g'>
132 , you can use the \verb|eps| option. This will create the music as
133 eps graphics and include it into the document with the
134 \verb|\includegraphics| command.
136 The code used look like this:
137 \begin{mudela}[eps, verbatim]
138 <c' e' g'> <b d' g'> <c'2 e' g'>
141 You can also use the \verb|eps| option if the block is a complete
142 mudela source. This 5 cm long empty line,
146 \paper{ linewidth = 5.\cm;}
149 was created with this code:
150 \begin{mudela}[eps, verbatim]
153 \paper{ linewidth = 5.\cm;}
156 To avoid that \LaTeX~places the music on a line of its one, there should
157 be no empty lines between the normal text and the mudela
160 There is an even shorter way to write small musical fragments. This
161 triad, \mudela{<c' e' g'>}, was created with this code:
162 \verb|\mudela{<c' e' g'>}|
164 Mudela-book let you define your own commands, see the file
165 \verb|mudela-book-defs.py|. In a later version, it will be possible to
166 have your own file that defines new commands. To print small rhythms
167 like this, \mudelaRhythm{c4 r8 [c16 c] c4 c}, the default
168 \verb|mudela-book-defs.py| also defines a command \verb|mudelaRhythm|.
169 The last music was created like this:
170 \verb|\mudelaRhytm{c4 r8 [c16 c] c4 c}|. This feature is higly
171 experimental, so Things Will Change.
173 The last example show that we need options to change the
174 % LONG line just to test multiple mudela on one line
175 fontsize of the music. 11pt, \mudela[11pt]{<c' e' g'>} or 13pt, \mudela[13pt]{<c' e' g'>} is probably a better fontsize
176 if you include music in the middle of the text. The code looks like this:
177 \verb|\mudela[11pt]{<c' e' g'>}|
180 \begin{mudela}[13pt, verbatim]
184 The following options set the fontsize:
187 \begin{mudela}[11pt, eps]
189 r16 [c d e][f d e c] [g'8 c][b-\prall c] |
190 [d16 g, a b][c a b g][d'8 g f-\prall g]
194 \begin{mudela}[13pt, eps]
196 r16 [c d e][f d e c] [g'8 c][b-\prall c] |
197 [d16 g, a b][c a b g][d'8 g f-\prall g]
201 \begin{mudela}[16pt, eps]
203 r16 [c d e][f d e c] [g'8 c][b-\prall c] |
204 [d16 g, a b][c a b g][d'8 g f-\prall g]
208 \begin{mudela}[20pt, eps]
210 r16 [c d e][f d e c] [g'8 c][b-\prall c] |
211 [d16 g, a b][c a b g][d'8 g f-\prall g]
215 \begin{mudela}[26pt, eps]
217 r16 [c d e][f d e c] [g'8 c][b-\prall c] |
218 [d16 g, a b][c a b g][d'8 g f-\prall g]
223 This was all options to \verb|\begin{mudela}|. The rest of the
224 document will show some ways you can use mudela in
225 \LaTeX~documents. It will also act as a simple test-suite for
226 mudela-book. You \marginpar{
228 \begin{mudela}[eps, 11pt]
229 \relative c'' {\key c \minor; r4 [g8 g g] es2}
231 }can place \verb|eps| mudela in footnotes\footnote{
233 \begin{mudela}[eps, 11pt]
234 \relative c'' {\key c \minor;r4 [g8 g g] es2}
237 and marginspars just as any other included eps graphics.
239 \begin{floatingfigure}[r]{7cm}
244 r4-\fermata [b16-.( )b-.] [f'8-- dis16-.( )dis-. gis8--]
245 [f16-.( )f-. dis8-- gis16-.( )gis-.] cis4.-\fermata |
247 r4.-\fermata [cis,16 cis g'8 f16 f b][g16 g f8 b16 b] dis4.-\fermata
249 \paper{linewidth = 7.\cm;}
254 To the right you can see some bars from the trumpet fanfara from the
255 beginning of the fantastic street opera ``Houdini the Great'', by the
256 danish composer Andy Pape. The music is put inside a
257 \verb|floatingfigure| environment, and the music will be aligned by
258 the right marging if you set floatingfigure width and mudela linewidth
259 to the same value. The code looks like this:
261 \verb|\begin{floatingfigure}{7cm}|
262 \begin{mudela}[verbatim]
266 r4.-\fermata [b16-.( )b-.] [f'8-- dis16-.( )dis-. gis8--]
267 [f16-.( )f-. dis8-- gis16-.( )gis-.] cis8.-\fermata |
269 r4.-\fermata [cis,16 cis g'8 f16 f b]
270 [g16 g f8 b16 b] dis4.-\fermata
272 \paper{linewidth = 7.\cm;}
275 \verb|\end{floatingfigure}|
277 \twocolumn[\large The following is written in two columns just to show
278 what mudela-book can do..\normalsize]
280 Tabulars is also nice. Here you have a chance to learn the norwegian
281 names of some triads:
284 \begin{tabular}{|l|l|}
311 If you have a lot of small music examples
312 like this in the middle of your text, you might get a nicer look by
313 using ``double'' line spacing. Put the \verb|\linespread{1.6}| command
314 into the preamble of your document. Then the line spacing will not be
315 increased between the lines where you have music printed with the
318 Sinse the version number is quite low, you should be careful not to
319 mix braces that belongs to mudela-book and \LaTeX~on the same
320 line. The following code will probably break:
322 \verb|\footnote{\begin{mudela}|
324 \verb|\relative c''{ \key es; r8 [g g g] es2} |
328 Mudela-book does know about \verb|\onecolumn| and \verb|\twocolumn|.
329 So the music will be adjusted to the new linewith:
330 \begin{mudela}[verbatim]
332 \notes\relative c'{c d e f | g2 g | a4 a a a | g1 |
333 f4 f f f | e2 e | d4 d d d | c1}
339 \notes\relative c'{c d e f | g2 g | a4 a a a | g1 |
340 f4 f f f | e2 e | d4 d d d | c1}
344 Verbatim environments will also ignore the page margins. That is
345 a feature of \LaTeX. (But you usually put things inside a verbatim
346 environment when you don't want \LaTeX~to do any linebreaking)