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