2 % This is way too long and hairy
8 \documentclass[a4paper, 12pt]{article}
10 %\def\preLilypondExample{}
11 %\def\postLilypondExample{}
12 %\usepackage{graphics}
13 %\usepackage{landscape}
16 %uncomment this to try twocolumn mode
20 \section{Lilypond-book + LaTeX}
22 This is an examplefile for mixing Lilypond and Latex. It is also
23 used to test lilypond-book. View the source to see how it is done.
29 \notes\relative c'{c d e f g a b c}
33 Lilypond-book search for the \verb|\score| command when it decides
34 if the code is only a fragment. Thus, in the following code, you have
35 to use \verb|fragment| option, because the comment confuses lilypond-book.
37 \begin[fragment]{lilypond}
41 There is also a shorthand version \verb|\lilypond{c' e' g'}|:
45 that is the same as writing
53 \begin[eps, 11pt]{lilypond}
56 and C minor \lilypond[11pt]{c' es' g'} chords are floating inside the text.
58 \subsection{verb and verbatim}
60 As you see, the begin/end verbatim command inside
61 does not confuse lilypond-book:
63 \verb|\begin{lilypond}c d e\end{lilypond}|
65 Neither does a verbatim inside verb:
67 \verb|\begin{verbatim}\begin{lilypond}c d e\end{lilypond}\end{verbatim}|
69 or verb inside verbatim:
72 \verb|\begin{lilypond}c d e\end{lilypond}|
75 But this is just to stress \verb|lilypond-book|. What you need is:
77 \verb|\lilypond{c' d' e'}|
87 \subsection{The 'verbatim' and 'intertext' option}
88 This shows the verbatim option:
89 \begin[verbatim, intertext="gives this music:"]{lilypond}
93 \subsection{LaTeX comments}
94 This is a line with lilypond code after the comment char % \lilypond{<c' e' g'>}
95 % \lilypond{<c' e' g'>}
97 If you do not see any music from the heading 'LaTeX comments' and until
98 this line, then lilypond-book is handling latex comments pretty well :-)
100 \subsection{To float or not to float}
102 \begin[eps]{lilypond}
105 should be floating inside the text by using the \verb|eps| options.
109 \begin[eps]{lilypond}
113 has also the \verb|eps| options, but is not floating because there
114 are an emptry line before and after the lilypond block. That is
115 correct behaviour because it follows La\TeX{} convention that an
116 empty line signals a new paragraph. Note that the \verb|eps| option
117 is not necessary when you want the music in a paragraph on its own.
119 \subsection{More examples}
123 \item \lilypond[11pt]{ c'} do
124 \item \lilypond[11pt]{d'} re
125 \item \lilypond[11pt]{e'} mi
126 \item \lilypond[11pt]{f'} fa
127 \item \lilypond[11pt]{g'} sol
130 Tables\footnote{ and footnote: \lilypond[eps,11pt]{c' e' g'} }:
131 \marginpar{ Yes, even as marginpar
132 \lilypond[eps,11pt]{c' d' e'} }
134 \begin{tabular}{|l|l|r|}
136 \em Notes & \em Name \\
138 \lilypond[11pt, filename="cdur"]{<c' e' g'>} & major \\
139 \lilypond[11pt]{<c' es' g'>} & minor \\
140 \lilypond[11pt]{<c' es' ges'>} & diminished \\
141 \lilypond[11pt]{<c' e' gis'>} & augmented \\
147 Testing of spacing. The next music is surrounded by an empty line.
148 text text text text text text text text text text text text
149 text text text text text text text text text text text text
152 \score{ \notes\relative c'{ c d e f g a b c} }
155 text text text text text text text text text text text text
156 text text text text text text text text text text text text
157 text text text text text text text text text text text text
159 Next has no empty lines.
160 text text text text text text text text text text text text
161 text text text text text text text text text text text text
162 text text text text text text text text text text text text
164 \score{ \notes\relative c'{ c d e f g a b c} }
166 text text text text text text text text text text text text
167 text text text text text text text text text text text text
169 %% need to use an -I ../../../input/test to find the file
170 %% \lilypondfile{tie.ly}