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