26.10.2014 Views

Section “Troubleshooting” in Application Usage - LilyPond

Section “Troubleshooting” in Application Usage - LilyPond

Section “Troubleshooting” in Application Usage - LilyPond

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 3: Runn<strong>in</strong>g lilypond-book 18<br />

3 Runn<strong>in</strong>g lilypond-book<br />

If you want to add pictures of music to a document, you can simply do it the way you would do<br />

with other types of pictures. The pictures are created separately, yield<strong>in</strong>g PostScript output or<br />

PNG images, and those are <strong>in</strong>cluded <strong>in</strong>to a L A TEX or HTML document.<br />

lilypond-book provides a way to automate this process: This program extracts snippets of<br />

music from your document, runs lilypond on them, and outputs the document with pictures<br />

substituted for the music. The l<strong>in</strong>e width and font size def<strong>in</strong>itions for the music are adjusted to<br />

match the layout of your document.<br />

This is a separate program from lilypond itself, and is run on the command l<strong>in</strong>e; for<br />

more <strong>in</strong>formation, see <strong>Section</strong> 1.2 [Command-l<strong>in</strong>e usage], page 1. If you have trouble runn<strong>in</strong>g<br />

lilypond-book on W<strong>in</strong>dows or Mac OS X us<strong>in</strong>g the command l<strong>in</strong>e, then see either <strong>Section</strong><br />

“W<strong>in</strong>dows” <strong>in</strong> General Information or <strong>Section</strong> “MacOS X” <strong>in</strong> General Information.<br />

This procedure may be applied to L A TEX, HTML, Tex<strong>in</strong>fo or DocBook documents.<br />

3.1 An example of a musicological document<br />

Some texts conta<strong>in</strong> music examples. These texts are musicological treatises, songbooks, or<br />

manuals like this. Such texts can be made by hand, simply by import<strong>in</strong>g a PostScript figure<br />

<strong>in</strong>to the word processor. However, there is an automated procedure to reduce the amount of<br />

work <strong>in</strong>volved <strong>in</strong> HTML, L A TEX, Tex<strong>in</strong>fo and DocBook documents.<br />

A script called lilypond-book will extract the music fragments, format them, and put back<br />

the result<strong>in</strong>g notation. Here we show a small example for use with L A TEX. The example also<br />

conta<strong>in</strong>s explanatory text, so we will not comment on it further.<br />

Input<br />

\documentclass[a4paper]{article}<br />

\beg<strong>in</strong>{document}<br />

Documents for \verb+lilypond-book+ may freely mix music and text.<br />

For example,<br />

\beg<strong>in</strong>{lilypond}<br />

\relative c' {<br />

c2 e2 \tuplet 3/2 { f8 a b } a2 e4<br />

}<br />

\end{lilypond}<br />

Options are put <strong>in</strong> brackets.<br />

\beg<strong>in</strong>{lilypond}[fragment,quote,staffsize=26,verbatim]<br />

c'4 f16<br />

\end{lilypond}<br />

Larger examples can be put <strong>in</strong>to a separate file, and <strong>in</strong>troduced with<br />

\verb+\lilypondfile+.<br />

\lilypondfile[quote,no<strong>in</strong>dent]{screech-and-bo<strong>in</strong>k.ly}<br />

(If needed, replace @file{screech-and-bo<strong>in</strong>k.ly} by any @file{.ly} file

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!