]> git.donarmstrong.com Git - lilypond.git/blob - input/tutorial/lilbook.tex
release: 1.3.147
[lilypond.git] / input / tutorial / lilbook.tex
1 \documentclass[a4paper]{article}
2 \begin{document}
3
4 In a lilypond-book document, you can freely mix music and text. For
5 example:
6 \begin{lilypond}
7   \score { \notes \relative c' {
8      c2 g'2 \times 2/3 { f8 e d } c'2 g4
9   } }
10 \end{lilypond}
11 Notice that the music line length matches the margin settings of the
12 document.
13
14 If you have no \verb+\score+ block in the fragment,
15 \texttt{lilypond-book} will supply one:
16
17 \begin{lilypond}
18   c'4
19 \end{lilypond}
20
21 In the example you see here, a number of things happened: a
22 \verb+\score+ block was added, and the line width was set to natural
23 length. You can specify many more options using  \LaTeX style options
24 in brackets:
25
26 \begin[verbatim,11pt,singleline,
27   fragment,relative,intertext="hi there!"]{lilypond}
28   c'4 f bes es
29 \end{lilypond}
30
31 \texttt{verbatim} also shows the lilypond code, \texttt{11pt} selects
32 the default music size, \texttt{fragment} adds a score block,
33 \texttt{relative} uses relative mode for the fragment, and
34 \texttt{intertext} specifies what to print between the
35 \texttt{verbatim} code and the music.
36
37 If you include large examples into the text, it may be more convenient
38 to put the example in a separate file:
39
40 \lilypondfile[printfilename]{sammartini.ly}
41
42 The \texttt{printfilename} option adds the file name to the output.
43
44 \end{document}