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