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