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