]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/lilypond-book.itely
Merge branch 'master' of ssh+git://hanwen@git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / Documentation / user / lilypond-book.itely
1 c -*- coding: utf-8; mode: texinfo; -*-
2
3
4 @ignore
5
6 TODO: cleanup
7
8 ** AARGH.  We also have tutorial.itely: Integrating text and music.
9
10    Could also do with a cleanup.  Lost inspiration to fix this manual
11    where to describe what?
12
13 @end ignore
14
15
16 @c Note: keep this node named so that `info lilypond-book' brings you here.
17 @node LilyPond-book
18 @chapter @command{lilypond-book}: Integrating text and music
19
20 If you want to add pictures of music to a document, you can simply do it
21 the way you would do with other types of pictures.  The pictures are
22 created separately, yielding PostScript output or PNG images, and those
23 are included into a La@TeX{} or HTML document.
24
25 @command{lilypond-book} provides a way to automate this process: This
26 program extracts snippets of music from your document, runs
27 @command{lilypond} on them, and outputs the document with pictures
28 substituted for the music.  The line width and font size definitions for
29 the music are adjusted to match the layout of your document.
30
31 This procedure may be applied to La@TeX{}, HTML, Texinfo or DocBook documents.
32
33 @menu
34 * An example of a musicological document::  
35 * Integrating LaTeX and music::  
36 * Integrating Texinfo and music::  
37 * Integrating HTML and music::  
38 * Integrating DocBook and music::
39 * Music fragment options::      
40 * Invoking lilypond-book::      
41 * Filename extensions::         
42 * Many quotes of a large score::  
43 * Inserting LilyPond output into other programs::  
44 @end menu
45
46
47 @node An example of a musicological document
48 @section An example of a musicological document
49
50 @cindex musicology
51 @cindex La@TeX{}, music in
52 @cindex HTML, music in
53 @cindex Texinfo, music in
54 @cindex DocBook, music in
55 Some texts contain music examples.  These texts are musicological
56 treatises, songbooks, or manuals like this.  Such texts can be made by
57 hand, simply by importing a PostScript figure into the word processor.
58 However, there is an automated procedure to reduce the amount of work
59 involved in HTML, La@TeX{}, Texinfo and DocBook documents.
60
61 A script called @code{lilypond-book} will extract the music fragments,
62 format them, and put back the resulting notation.  Here we show a small
63 example for use with La@TeX{}.  The example also contains explanatory
64 text, so we will not comment on it further.
65
66 @quotation
67 @verbatim
68 \documentclass[a4paper]{article}
69
70 \begin{document}
71
72 Documents for @command{lilypond-book} may freely mix music and text.
73 For example,
74
75 \begin{lilypond}
76 \relative c' {
77   c2 g'2 \times 2/3 { f8 e d } c'2 g4
78 }
79 \end{lilypond}
80
81 Options are put in brackets.
82
83 \begin[fragment,quote,staffsize=26,verbatim]{lilypond}
84   c'4 f16
85 \end{lilypond}
86
87 Larger examples can be put into a separate file, and introduced with
88 \verb+\lilypondfile+.
89
90 \lilypondfile[quote,noindent]{screech-boink.ly}
91
92 \end{document}
93 @end verbatim
94 @end quotation
95
96 Under Unix, you can view the results as follows
97
98 @example
99 cd input/tutorial
100 mkdir -p out/
101 lilypond-book --output=out --psfonts lilybook.tex
102 @emph{lilypond-book (GNU LilyPond) 2.6.0}
103 @emph{Reading lilybook.tex...}
104 @emph{..lots of stuff deleted..}
105 @emph{Compiling out/lilybook.tex...}
106 cd out
107 latex lilybook
108 @emph{lots of stuff deleted}
109 xdvi lilybook
110 @end example
111
112 To convert the file into a PDF document, run the following commands
113
114 @example
115 dvips -o -Ppdf -h lilybook.psfonts lilybook
116 ps2pdf lilybook.ps
117 @end example
118
119 If you are running latex in twocolumn mode, remember to add
120 @code{-t landscape} to the dvips options.
121
122 Running @command{lilypond-book} and @command{latex} creates a lot of
123 temporary files, which would clutter up the working directory.  To
124 remedy this, use the @code{--output=@var{dir}} option.  It will create
125 the files in a separate subdirectory @file{dir}.
126
127 Running dvips will produce many warnings about fonts.  They are not
128 harmful; please ignore them.
129
130 Finally the result of the La@TeX{} example shown above.@footnote{This
131 tutorial is processed with Texinfo, so the example gives slightly
132 different results in layout.}  This finishes the tutorial section.
133
134 @page
135
136 Documents for @command{lilypond-book} may freely mix music and text.
137 For example,
138
139 @lilypond
140 \relative c' {
141   c2 g'2 \times 2/3 { f8 e d } c'2 g4
142 }
143 @end lilypond
144
145 Options are put in brackets.
146
147 @lilypond[fragment,quote,staffsize=26,verbatim]
148 c'4 f16
149 @end lilypond
150
151 Larger examples can be put into a separate file, and introduced with
152 @code{\lilypondfile}.
153
154 @lilypondfile[quote,noindent]{screech-boink.ly}
155
156 @page
157
158 @cindex texinfo
159 @cindex latex
160 @cindex texinfo
161 @funindex texi
162 @cindex html
163 @cindex docbook
164 @cindex documents, adding music to
165
166
167 @node Integrating LaTeX and music
168 @section Integrating La@TeX{} and music
169
170 La@TeX{} is the de-facto standard for publishing layouts in the exact
171 sciences.  It is built on top of the @TeX{} typesetting engine,
172 providing the best typography available anywhere.
173
174 See
175 @uref{http://@/www@/.ctan@/.org/@/tex@/-archive/@/info/@/lshort/@/english/,
176 @emph{The Not So Short Introduction to La@TeX{}}} for an overview on how
177 to use La@TeX{}.
178
179 Music is entered using
180
181 @example
182 \begin[options,go,here]@{lilypond@}
183   YOUR LILYPOND CODE
184 \end@{lilypond@}
185 @end example
186
187 @noindent
188 or
189
190 @example
191 \lilypondfile[options,go,here]@{@var{filename}@}
192 @end example
193
194 @noindent
195 or
196
197 @example
198 \lilypond@{ YOUR LILYPOND CODE @}
199 @end example
200
201 Running @command{lilypond-book} yields a file that can be further
202 processed with La@TeX{}.
203
204 We show some examples here.  The lilypond environment
205
206 @example
207 \begin[quote,fragment,staffsize=26]@{lilypond@}
208   c' d' e' f' g'2 g'2
209 \end@{lilypond@}
210 @end example
211
212 @noindent
213 produces
214
215 @lilypond[quote,fragment,staffsize=26]
216 c' d' e' f' g'2 g'2
217 @end lilypond
218
219 The short version
220
221 @example
222 \lilypond[quote,fragment,staffsize=11]@{<c' e' g'>@}
223 @end example
224
225 @noindent
226 produces
227
228 @lilypond[quote,fragment,staffsize=11]{<c' e' g'>}
229
230 @noindent
231 Currently, you cannot include @code{@{} or @code{@}} within
232 @code{\lilypond@{@}}, so this command is only useful with the
233 @code{fragment} option.
234
235 The default line width of the music will be adjusted by examining the
236 commands in the document preamble, the part of the document before
237 @code{\begin@{document@}}.  The @command{lilypond-book} command sends
238 these to La@TeX{} to find out how wide the text is.  The line width for
239 the music fragments is then adjusted to the text width.  Note that this
240 heuristic algorithm can fail easily; in such cases it is necessary to
241 use the @code{line-width} music fragment option.
242
243 @cindex titling and lilypond-book
244 @funindex \header in La@TeX{} documents
245
246 Each snippet will call the following macros if they have been defined by
247 the user:
248
249 @code{\preLilyPondExample} called before the music
250
251 @code{\postLilyPondExample} called after the music
252
253 @code{\betweenLilyPondSystem[1]} is called between systems if
254 @code{lilypond-book} has split the snippet into several postscript
255 files.  It must be defined as taking one parameter and will be
256 passed the number of files already included in this snippet.
257 The default is to simply insert a @code{\linebreak}.
258
259 @ignore
260 Broken stuff.  :(
261
262 @cindex Latex, feta symbols
263 @cindex fetachar
264
265 To include feta symbols (such as flat, segno, etc) in a LaTeX
266 document, use @code{\input@{titledefs@}}
267
268 @example
269 \documentclass[a4paper]@{article@}
270
271 \input@{titledefs@}
272
273 \begin@{document@}
274
275 \fetachar\fetasharp
276
277 \end@{document@}
278 @end example
279
280 The font symbol names are defined in the file feta20.tex; to find
281 the location of this file, use the command
282
283 @example
284 kpsewhich feta20.tex
285 @end example
286
287 @end ignore
288
289 @cindex outline fonts
290 @cindex type1 fonts
291 @cindex dvips
292 @cindex invoking dvips
293
294 For printing the La@TeX{} document you need a DVI to PostScript
295 translator like @command{dvips}.  To use @command{dvips} to produce
296 a PostScript file, add the following options to the @command{dvips}
297 command line:
298
299 @example
300 -o -Ppdf -h @var{file}.psfonts
301 @end example
302
303 @noindent
304 where the @var{file}@command{psfonts} file is obtained from
305 @command{lilypond-book}, @xref{Invoking lilypond-book}, for details. PDF
306 can then be produced with a PostScript to PDF translator like
307 @code{ps2pdf} (which is part of GhostScript).  Running @command{dvips}
308 will produce some warnings about fonts; these are harmless and may
309 be ignored.
310
311 If you are running latex in twocolumn mode, remember to add
312 @code{-t landscape} to the dvips options.
313
314 @cindex international characters
315 @cindex latin1
316
317 Sometimes it is useful to display music elements (such as ties and slurs)
318 as if they continued after the end of the fragment.  This can be done by
319 breaking the staff and suppressing inclusion of the rest of the lilypond
320 output.
321
322 In La@TeX{}, define @code{\betweenLilyPondSystem} in such a way that
323 inclusion of other systems is terminated once the required number of
324 systems are included.  Since @code{\betweenLilypondSystem} is first
325 called @b{after} the first system, including only the first system
326 is trivial.
327
328 @example
329 \def\betweenLilyPondSystem#1@{\endinput@}
330
331 \begin[fragment]@{lilypond@}
332   c'1\( e'( c'~ \break c' d) e f\)
333 \end@{lilypond@}
334 @end example
335
336 If a greater number of systems is requested, a TeX conditional must be
337 used before the @code{\endinput}.  In this example, replace "2" by
338 the numer of systems you want in the output,
339
340 @example
341 \def\betweenLilyPondSystem#1@{
342     \ifnum##1<2\else\endinput\fi
343 @}
344 @end example
345
346 Remember that the definition of @code{\betweenLilyPondSystem} is
347 effective until @TeX{} quits the current group (such as the La@TeX{}
348 environment) or is overridden by another definition (which is, in
349 most cases, for the rest of the document).  To reset your
350 definition, write
351
352 @example
353 \let\betweenLilyPondSystem\undefined
354 @end example
355
356 @noindent
357 in your LaTeX source.
358
359 This may be simplified by defining a @TeX{} macro
360
361 @example
362 \def\onlyFirstNSystems#1@{
363     \def\betweenLilyPondSystem##1@{\ifnum##1<#1\else\endinput\fi@}
364 @}
365 @end example
366
367 @noindent
368 and then saying only how many systems you want before each fragment,
369
370 @example
371 \onlyFirstNSystems@{3@}
372 \begin@{lilypond@}...\end@{lilypond@}
373 \onlyFirstNSystems@{1@}
374 \begin@{lilypond@}...\end@{lilypond@}
375 @end example
376
377
378 @node Integrating Texinfo and music
379 @section Integrating Texinfo and music
380
381 Texinfo is the standard format for documentation of the GNU project.  An
382 example of a Texinfo document is this manual.  The HTML, PDF, and Info
383 versions of the manual are made from the Texinfo document.
384
385 In the input file, music is specified with
386
387 @example
388 @@lilypond[options,go,here]
389   YOUR LILYPOND CODE
390 @@end lilypond
391 @end example
392
393 @noindent
394 or
395
396 @example
397 @@lilypond[options,go,here]@{ YOUR LILYPOND CODE @}
398 @end example
399
400 @noindent
401 or
402
403 @example
404 @@lilypondfile[options,go,here]@{@var{filename}@}
405 @end example
406
407 When @command{lilypond-book} is run on it, this results in a Texinfo
408 file (with extension @file{.texi}) containing @code{@@image} tags for
409 HTML and info output.  For the printed edition, the raw @TeX{} output of
410 LilyPond is included in the main document.
411
412 We show two simple examples here.  A @code{lilypond} environment
413
414 @example
415 @@lilypond[fragment]
416 c' d' e' f' g'2 g'
417 @@end lilypond
418 @end example
419
420 @noindent
421 produces
422
423 @lilypond[fragment]
424 c' d' e' f' g'2 g'
425 @end lilypond
426
427 The short version
428
429 @example
430 @@lilypond[fragment,staffsize=11]@{<c' e' g'>@}
431 @end example
432
433 @noindent
434 produces
435
436 @lilypond[fragment,staffsize=11]{<c' e' g'>}
437
438 Contrary to La@TeX{}, @code{@@lilypond@{...@}} does not generate an
439 in-line image.  It always gets a paragraph of its own.
440
441 When using the Texinfo output format, @command{lilypond-book} also
442 generates bitmaps of the music (in PNG format), so you can make an HTML
443 document with embedded music.
444
445
446 @node Integrating HTML and music
447 @section Integrating HTML and music
448
449 Music is entered using
450
451 @example
452 <lilypond fragment relative=2>
453 \key c \minor c4 es g2
454 </lilypond>
455 @end example
456
457 @noindent
458 @command{lilypond-book} then produces an HTML file with appropriate image
459 tags for the music fragments:
460
461 @lilypond[fragment,relative=2]
462 \key c \minor c4 es g2
463 @end lilypond
464
465 For inline pictures, use @code{<lilypond ... />}, where the options
466 are separated by a colon from the music, for example
467
468 @example
469 Some music in <lilypond relative=2: a b c/> a line of text.
470 @end example
471
472 To include separate files, say
473
474 @example
475 <lilypondfile @var{option1} @var{option2} ...>@var{filename}</lilypondfile>
476 @end example
477
478 @cindex titling in HTML
479 @cindex preview image
480 @cindex thumbnail
481
482 @node Integrating DocBook and music
483 @section Integrating DocBook and music
484
485 For inserting LilyPond snippets it is good to keep the conformity of
486 our DocBook document, thus allowing us to use DocBook editors,
487 validation etc. So we don't use custom tags, only specify a convention
488 based on the standard DocBook elements.
489
490 @unnumberedsubsec Common conventions
491
492 For inserting all type of snippets we use the @code{mediaobject} and @code{inlinemediaobject} element, so our snippets can be
493 formatted inline or not inline.
494 The snippet formatting options are always provided in the @code{role} property of the innermost element (see in next sections). Tags are
495 chosen to allow DocBook editors format the content gracefully.
496 The DocBook files to be processed with @command{lilypond-book} should have the extension @file{.lyxml}.
497
498 @unnumberedsubsec Including a LilyPond file
499
500 This is the most simple case. We must use the @file{.ly} extension for the included file, and insert it as a standard @code{imageobject},
501 with the following structure:
502
503 @example
504 <mediaobject>
505   <imageobject>
506     <imagedata fileref="music1.ly" role="printfilename" />
507   </imageobject>
508 </mediaobject>
509 @end example
510
511 Note that you can use mediaobject or inlinemediaobject as the outermost element as you wish.
512
513 @unnumberedsubsec Including LilyPond code
514
515 Including LilyPond code is possible by using a @code{programlisting}, where the language is set to @code{lilypond} with the following structure:
516
517 @example
518 <inlinemediaobject>
519   <textobject>
520     <programlisting language="lilypond" role="fragment verbatim staffsize=16 ragged-right relative=2">
521 \context Staff \with @{
522   \remove Time_signature_engraver
523   \remove Clef_engraver@} 
524   @{ c4( fis) @}
525     </programlisting>
526   </textobject>
527 </inlinemediaobject>
528 @end example
529
530 As you can see, the outermost element is a @code{mediaobject} or @code{inlinemediaobject}, and there is a @code{textobject} containing the @code{programlisting} inside.
531
532 @unnumberedsubsec Processing the DocBook document
533
534 Running @command{lilypond-book} on our @file{.lyxml} file will create a valid DocBook document to be further processed with @file{.xml} extension.
535 If you use @uref{http://@/dblatex@/.sourceforge@/.net@/,dblatex}, it will create a PDF file from this document automatically. 
536 For HTML (HTML Help, JavaHelp etc.) generation you can use the official DocBook XSL stylesheets, however, it is possible that you have to make some customization for it.
537
538 @node Music fragment options
539 @section Music fragment options
540
541 In the following, a ``LilyPond command'' refers to any command described
542 in the previous sections which is handled by @command{lilypond-book} to
543 produce a music snippet.  For simplicity, LilyPond commands are only
544 shown in La@TeX{} syntax.
545
546 Note that the option string is parsed from left to right; if an option
547 occurs multiple times, the last one is taken.
548
549 The following options are available for LilyPond commands:
550
551 @table @code
552 @item staffsize=@var{ht}
553 Set staff size to @var{ht}, which is measured in points.
554
555 @item ragged-right
556 Produce ragged-right lines with natural spacing (i.e., @code{ragged-right
557 = ##t} is added to the LilyPond snippet).  This is the default for the
558 @code{\lilypond@{@}} command if no @code{line-width} option is present.
559 It is also the default for the @code{lilypond} environment if the
560 @code{fragment} option is set, and no line width is explicitly
561 specified.
562
563 @item packed
564 Produce lines with packed spacing (i.e., @code{packed = ##t} is added
565 to the LilyPond snippet).
566
567 @item line-width
568 @itemx line-width=@var{size}\@var{unit}
569 Set line width to @var{size}, using @var{unit} as units.  @var{unit} is
570 one of the following strings: @code{cm}, @code{mm}, @code{in}, or
571 @code{pt}.  This option affects LilyPond output (this is, the staff
572 length of the music snippet), not the text layout.
573
574 If used without an argument, set line width to a default value (as
575 computed with a heuristic algorithm).
576
577 If no @code{line-width} option is given, @command{lilypond-book} tries to
578 guess a default for @code{lilypond} environments which don't use the
579 @code{ragged-right} option.
580
581 @item notime
582 Do not print the time signature, and turns off the timing (key signature,
583 bar lines) in the score.
584
585 @item fragment
586 Make @command{lilypond-book} add some boilerplate code so that you can
587 simply enter, say,
588
589 @example
590 c'4
591 @end example
592
593 @noindent
594 without @code{\layout}, @code{\score}, etc.
595
596 @item nofragment
597 Don't add additional code to complete LilyPond code in music snippets.
598 Since this is the default, @code{nofragment} is redundant normally.
599
600 @item indent=@var{size}\@var{unit}
601 Set indentation of the first music system to @var{size}, using
602 @var{unit} as units. @var{unit} is one of the following strings:
603 @code{cm}, @code{mm}, @code{in}, or @code{pt}.  This option affects
604 LilyPond, not the text layout.
605
606 @item noindent
607 Set indentation of the first music system to zero.  This option affects
608 LilyPond, not the text layout.  Since no indentation is the default,
609 @code{noindent} is redundant normally.
610
611 @item quote
612 Reduce line length of a music snippet by @math{2*0.4}@dmn{in} and put
613 the output into a quotation block.  The value `0.4@dmn{in}' can be
614 controlled with the @code{exampleindent} option.
615
616 @item exampleindent
617 Set the amount by which the @code{quote} option indents a music snippet.
618
619 @item relative
620 @itemx relative=@var{n}
621 Use relative octave mode.  By default, notes are specified relative to
622 middle@tie{}C.  The optional integer argument specifies the octave of
623 the starting note, where the default @code{1} is middle C.
624 @end table
625
626 LilyPond also uses @command{lilypond-book} to produce its own
627 documentation.  To do that, some more obscure music fragment options are
628 available.
629
630 @table @code
631 @item verbatim
632 The argument of a LilyPond command is copied to the output file and
633 enclosed in a verbatim block, followed by any text given with the
634 @code{intertext} option (not implemented yet); then the actual music is
635 displayed.  This option does not work well with @code{\lilypond@{@}} if
636 it is part of a paragraph.
637
638 @item texidoc
639 (Only for Texinfo output.)  If @command{lilypond} is called with the
640 @option{--header=@/texidoc} option, and the file to be processed is
641 called @file{foo@/.ly}, it creates a file @file{foo@/.texidoc} if there
642 is a @code{texidoc} field in the @code{\header}.  The @code{texidoc}
643 option makes @command{lilypond-book} include such files, adding its
644 contents as a documentation block right before the music snippet.
645
646 Assuming the file @file{foo@/.ly} contains
647
648 @example
649 \header @{
650   texidoc = "This file demonstrates a single note."
651 @}
652 @{ c'4 @}
653 @end example
654
655 @noindent
656 and we have this in our Texinfo document @file{test.texinfo}
657
658 @example
659 @@lilypondfile[texidoc]@{foo.ly@}
660 @end example
661
662 @noindent
663 the following command line gives the expected result
664
665 @example
666 lilypond-book --process="lilypond --format=tex --tex \
667               --header=texidoc test.texinfo
668 @end example
669
670 Most LilyPond test documents (in the @file{input} directory of the
671 distribution) are small @file{.ly} files which look exactly like this.
672
673 @item printfilename
674 If a LilyPond input file is included with @code{\lilypondfile}, print
675 the file name right before the music snippet.  For HTML output, this is
676 a link.
677
678 @item fontload
679 This option includes fonts in all of the generated EPS-files for this
680 snippet. This should be used if the snippet uses any font that LaTeX
681 cannot find on its own.
682
683 @end table
684
685
686 @node Invoking lilypond-book
687 @section Invoking @command{lilypond-book}
688
689 @command{lilypond-book} produces a file with one of the following
690 extensions: @file{.tex}, @file{.texi}, @file{.html}  or @file{.xml}, depending on the
691 output format.  All of @file{.tex}, @file{.texi} and @file{.xml} files need further
692 processing.
693
694 @command{lilypond-book} can also create a PSFONTS file, which is required
695 by @command{dvips} to produce Postscript and PDF files.
696
697 To produce PDF output from the lilypond-book file (here called
698 @code{yourfile.lytex}) via LaTeX, you should do
699
700 @example
701 lilypond-book --psfonts yourfile.lytex
702 latex yourfile.tex
703 dvips -o -h yourfile.psfonts -Ppdf yourfile.dvi
704 ps2pdf yourfile.ps
705 @end example
706
707 The @file{.dvi} file created by this process will not contain
708 noteheads.  This is normal; if you follow the instructions, they
709 will be included in the @file{.ps} and @file{.pdf} files.
710
711 To produce a PDF file through PDF(La)TeX, use
712  
713 @example
714 lilypond-book --pdf yourfile.pdftex
715 pdflatex yourfile.tex
716 @end example
717  
718
719 To produce a Texinfo document (in any output format), follow the normal
720 procedures for Texinfo (this is, either call @command{texi2dvi} or
721 @command{makeinfo}, depending on the output format you want to
722 create).
723 @ifinfo
724 @xref{Format with texi2dvi, , , texinfo, GNU Texinfo}, and @ref{Creating
725 an Info File, , , texinfo, GNU Texinfo}.
726 @end ifinfo
727 @ifnotinfo
728 See the documentation of Texinfo for further details.
729 @end ifnotinfo
730
731
732 @command{lilypond-book} accepts the following command line options:
733
734 @table @code
735 @item -f @var{format}
736 @itemx --format=@var{format}
737 Specify the document type to process: @code{html}, @code{latex}, @code{texi} (the default) or @code{docbook}.  If this option is missing,
738 @command{lilypond-book} tries to detect the format automatically.
739
740 The @code{texi} document type produces a Texinfo file with music
741 fragments in the DVI output only.  For getting images in the HTML
742 version, the format @code{texi-html} must be used instead.
743
744 [Note: Currently, @code{texi} is the same as @code{texi-html}.]
745
746 @item -F @var{filter}
747 @itemx --filter=@var{filter}
748 Pipe snippets through @var{filter}.  @code{lilypond-book} will
749 not --filter and --process at the same time.
750
751 Example:
752 @example
753 lilypond-book --filter='convert-ly --from=2.0.0 -' my-book.tely
754 @end example
755
756 @item -h
757 @itemx --help
758 Print a short help message.
759
760 @item -I @var{dir}
761 @itemx --include=@var{dir}
762 Add @var{dir} to the include path.
763
764 @item -o @var{dir}
765 @itemx --output=@var{dir}
766 Place generated files in directory @var{dir}.  Running
767 @command{lilypond-book} generates lots of small files that LilyPond will
768 process.  To avoid all that garbage in the source directory use the
769 @option{--output} command line option, and change to that directory
770 before running @command{latex} or @command{makeinfo}:
771
772 @example
773 lilypond-book --output=out yourfile.lytex
774 cd out
775 ...
776 @end example
777
778 @item -P @var{process}
779 @itemx --process=@var{command}
780 Process LilyPond snippets using @var{command}.  The default command is
781 @code{lilypond}.  @code{lilypond-book} will not --filter and --process
782 at the same time.
783
784 @itemx --psfonts
785 extract all PostScript fonts into @file{@var{file}.psfonts} for dvips.
786 This is necessary for @command{dvips -h @var{file}.psfonts}.
787
788 @item -V
789 @itemx --verbose
790 Be verbose.
791
792 @item -v
793 @itemx --version
794 Print version information.
795 @end table
796
797 @refbugs
798
799 The Texinfo command @code{@@pagesizes} is not interpreted.  Similarly,
800 La@TeX{} commands that change margins and line widths after the preamble
801 are ignored.
802
803 Only the first @code{\score} of a LilyPond block is processed.
804
805
806 @node Filename extensions
807 @section Filename extensions
808
809 You can use any filename extension for the input file, but if you do not
810 use the recommended extension for a particular format you may need to
811 manually specify the output format.  @xref{Invoking lilypond-book}, for
812 details.  Otherwise, @command{lilypond-book} automatically selects the
813 output format based on the input filename's extension.
814
815 @quotation
816 @multitable @columnfractions .2 .5
817 @item @strong{extension} @tab @strong{output format}
818 @item
819 @item @file{.html} @tab HTML
820 @item @file{.itely} @tab Texinfo
821 @item @file{.latex} @tab La@TeX{}
822 @item @file{.lytex} @tab La@TeX{}
823 @item @file{.lyxml} @tab DocBook
824 @item @file{.tely} @tab Texinfo
825 @item @file{.tex} @tab La@TeX{}
826 @item @file{.texi} @tab Texinfo
827 @item @file{.texinfo} @tab Texinfo
828 @item @file{.xml} @tab HTML
829 @end multitable
830 @end quotation
831
832
833 @node Many quotes of a large score
834 @section Many quotes of a large score
835
836 If you need to quote many fragments of a large score, you can also use
837 the clip systems feature, see @ref{Extracting fragments of notation}.
838
839
840 @ignore 
841 @n ode Inserting LilyPond output into OpenOffice.org
842 @s ection Inserting LilyPond output into OpenOffice.org
843
844 @c index OpenOffice.org
845
846 LilyPond notation can be added to OpenOffice.org with
847 @u ref{http://@/ooolilypond@/.sourceforge@/.net@/,OOoLilyPond}
848
849 @end ignore
850
851
852 @node Inserting LilyPond output into other programs
853 @section Inserting LilyPond output into other programs
854
855 To insert LilyPond output in other programs, use @code{lilypond}
856 instead of @code{lilypond-book}.  Each example must be created
857 individually and added to the document; consult the documentation for
858 that program.  Most programs will be able to insert lilypond output in
859 @file{PNG}, @file{EPS}, or @file{PDF} formats.
860
861 To reduce the white space around your lilypond score, use
862 the following options
863
864 @example
865 \paper@{
866   indent=0\mm
867   line-width=120\mm
868   oddFooterMarkup=##f
869   oddHeaderMarkup=##f
870   bookTitleMarkup = ##f
871   scoreTitleMarkup = ##f
872 @}
873
874 @{ c1 @}
875 @end example
876
877 To produce a useful @file{eps} file, use
878
879 @example
880 lilypond -b eps -dno-gs-load-fonts -dinclude-eps-fonts   myfile.ly
881 @end example
882