]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/usage/lilypond-book.itely
Doc: Usage: Add more explanation for LaTeX environ
[lilypond.git] / Documentation / usage / lilypond-book.itely
index 348f201e78f8f7cb209ed88f5ead1261a8766921..4707d7083c6d08f0ee35f3d869940cb26ae54ab5 100644 (file)
@@ -4,10 +4,11 @@
     Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
 
     When revising a translation, copy the HEAD committish of the
-    version that you are working on.  See TRANSLATION for details.
+    version that you are working on.  For details, see the Contributors'
+    Guide, node Updating translation committishes..
 @end ignore
 
-@c \version "2.12.0"
+@c \version "2.17.11"
 
 @c Note: keep this node named so that `info lilypond-book' brings you here.
 @node lilypond-book
@@ -25,24 +26,25 @@ substituted for the music.  The line width and font size definitions for
 the music are adjusted to match the layout of your document.
 
 This is a separate program from @command{lilypond} itself, and is run
-on the command line; for more information, see @ref{Command-line
-usage}.  If you have MacOS 10.3 or 10.4 and you have trouble running
-@code{lilypond-book}, see @rweb{MacOS X}.
+on the command line; for more information, see
+@ref{Command-line usage}.  If you have trouble running
+@code{lilypond-book} on Windows or Mac OS X using the command line, then
+see either @rweb{Windows} or @rweb{MacOS X}.
 
 This procedure may be applied to @LaTeX{}, HTML, Texinfo or DocBook
 documents.
 
 @cindex texinfo
-@cindex latex
+@cindex LaTex
 @cindex texinfo
 @cindex texi
-@cindex html
+@cindex HTML
 @cindex docbook
-@cindex documents, adding music to
-@cindex HTML, music in
-@cindex Texinfo, music in
-@cindex DocBook, music in
-@cindex @LaTeX{}, music in
+@cindex documents, adding music
+@cindex HTML, adding music
+@cindex Texinfo, adding music
+@cindex DocBook, adding music
+@cindex LaTeX, adding music
 
 @menu
 * An example of a musicological document::
@@ -51,6 +53,7 @@ documents.
 * Invoking lilypond-book::
 * Filename extensions::
 * lilypond-book templates::
+* Sharing the table of contents::
 * Alternate methods of mixing text and music::
 @end menu
 
@@ -83,23 +86,23 @@ For example,
 
 \begin{lilypond}
 \relative c' {
-  c2 g'2 \times 2/3 { f8 e d } c'2 g4
+  c2 e2 \tuplet 3/2 { f8 a b } a2 e4
 }
 \end{lilypond}
 
 Options are put in brackets.
 
-\begin[fragment,quote,staffsize=26,verbatim]{lilypond}
+\begin{lilypond}[fragment,quote,staffsize=26,verbatim]
   c'4 f16
 \end{lilypond}
 
 Larger examples can be put into a separate file, and introduced with
 \verb+\lilypondfile+.
 
-\lilypondfile[quote,noindent]{screech-boink.ly}
+\lilypondfile[quote,noindent]{screech-and-boink.ly}
 
-(If needed, replace screech-boink.ly by any .ly file you put in the same
-directory as this file.)
+(If needed, replace @file{screech-and-boink.ly} by any @file{.ly} file
+you put in the same directory as this file.)
 
 \end{document}
 @end verbatim
@@ -115,18 +118,18 @@ terminal run
 lilypond-book --output=out --pdf lilybook.lytex
 @emph{lilypond-book (GNU LilyPond) @version{} }
 @emph{Reading lilybook.lytex...}
-@emph{..lots of stuff deleted..}
+@emph{@dots{}lots of stuff deleted@dots{}}
 @emph{Compiling lilybook.tex...}
 cd out
 pdflatex lilybook
-@emph{..lots of stuff deleted..}
+@emph{@dots{}lots of stuff deleted@dots{}}
 xpdf lilybook
 @emph{(replace @command{xpdf} by your favorite PDF viewer)}
 @end example
 
 Running @command{lilypond-book} and @command{latex} creates a lot of
 temporary files, which would clutter up the working directory.  To
-remedy this, use the @code{--output=@var{dir}} option.  It will create
+remedy this, use the @option{--output=@var{dir}} option.  It will create
 the files in a separate subdirectory @file{dir}.
 
 Finally the result of the @LaTeX{} example shown above.@footnote{This
@@ -142,7 +145,7 @@ For example,
 
 @lilypond
 \relative c' {
-  c2 g'2 \times 2/3 { f8 e d } c'2 g4
+  c2 e2 \tuplet 3/2 { f8 a b } a2 e4
 }
 @end lilypond
 
@@ -155,8 +158,22 @@ c'4 f16
 Larger examples can be put into a separate file, and introduced with
 @code{\lilypondfile}.
 
-@lilypondfile[quote,noindent]{screech-boink.ly}
+@lilypondfile[quote,noindent]{screech-and-boink.ly}
 
+If a @code{tagline} is required, either default or custom, then the
+entire snippet must be enclosed in a @code{\book @{ @}} construct.
+
+@lilypond[papersize=a8,verbatim]
+\book{
+  \header{
+    title = "A scale in LilyPond"
+  }
+
+  \relative c' {
+    c d e f g a b c
+  }
+}
+@end lilypond
 
 @page
 
@@ -184,27 +201,44 @@ See
 @emph{The Not So Short Introduction to @LaTeX{}}} for an overview on how
 to use @LaTeX{}.
 
-Music is entered using
+@code{lilypond-book} provides the following commands and environments to
+include music in @LaTeX{} files:
+
+@itemize
+
+@item
+the @code{\lilypond@{@dots{}@}} command, where you can directly enter
+short lilypond code
+
+@item
+the @code{\begin@{lilypond@}@dots{}\end@{lilypond@}} environment, where
+you can directly enter longer lilypond code
+
+@item
+the @code{\lilypondfile@{@dots{}@}} command to insert a lilypond file
+
+@item
+the @code{\musicxmlfile@{@dots{}@}} command to insert a MusicXML file,
+which will be processed by @code{musicxml2ly} and @code{lilypond}.
+
+@end itemize
+
+In the input file, music is specified with any of the following commands:
 
 @example
-\begin[options,go,here]@{lilypond@}
+\begin@{lilypond@}[options,go,here]
   YOUR LILYPOND CODE
 \end@{lilypond@}
-@end example
 
-@noindent
-or
+\lilypond[options,go,here]@{ YOUR LILYPOND CODE @}
 
-@example
 \lilypondfile[options,go,here]@{@var{filename}@}
+
+\musicxmlfile[options,go,here]@{@var{filename}@}
 @end example
 
-@noindent
-or
 
-@example
-\lilypond[options,go,here]@{ YOUR LILYPOND CODE @}
-@end example
+@noindent
 
 Additionally, @code{\lilypondversion} displays the current version
 of lilypond.
@@ -214,7 +248,7 @@ processed with @LaTeX{}.
 We show some examples here.  The @code{lilypond} environment
 
 @example
-\begin[quote,fragment,staffsize=26]@{lilypond@}
+\begin@{lilypond@}[quote,fragment,staffsize=26]
   c' d' e' f' g'2 g'2
 \end@{lilypond@}
 @end example
@@ -314,7 +348,7 @@ is trivial.
 @example
 \def\betweenLilyPondSystem#1@{\endinput@}
 
-\begin[fragment]@{lilypond@}
+\begin@{lilypond@}[fragment]
   c'1\( e'( c'~ \break c' d) e f\)
 \end@{lilypond@}
 @end example
@@ -325,7 +359,7 @@ the number of systems you want in the output.
 
 @example
 \def\betweenLilyPondSystem#1@{
-    \ifnum##1<2\else\expandafter\endinput\fi
+    \ifnum#1<2\else\expandafter\endinput\fi
 @}
 @end example
 
@@ -362,9 +396,9 @@ and then saying only how many systems you want before each fragment,
 
 @example
 \onlyFirstNSystems@{3@}
-\begin@{lilypond@}...\end@{lilypond@}
+\begin@{lilypond@}@dots{}\end@{lilypond@}
 \onlyFirstNSystems@{1@}
-\begin@{lilypond@}...\end@{lilypond@}
+\begin@{lilypond@}@dots{}\end@{lilypond@}
 @end example
 
 
@@ -381,26 +415,40 @@ Texinfo is the standard format for documentation of the GNU project.  An
 example of a Texinfo document is this manual.  The HTML, PDF, and Info
 versions of the manual are made from the Texinfo document.
 
-In the input file, music is specified with
+@code{lilypond-book} provides the following commands and environments to
+include music into Texinfo files:
+
+@itemize
+
+@item
+the @code{@@lilypond@{@dots{}@}} command, where you can directly enter
+short lilypond code
+
+@item
+the @code{@@lilypond@dots{}@@end lilypond} environment, where you can
+directly enter longer lilypond code
+
+@item
+the @code{@@lilypondfile@{@dots{}@}} command to insert a lilypond file
+
+@item
+the @code{@@musicxmlfile@{@dots{}@}} command to insert a MusicXML file,
+which will be processed by @code{musicxml2ly} and @code{lilypond}.
+
+@end itemize
+
+In the input file, music is specified with any of the following commands
 
 @example
 @@lilypond[options,go,here]
   YOUR LILYPOND CODE
 @@end lilypond
-@end example
 
-@noindent
-or
-
-@example
 @@lilypond[options,go,here]@{ YOUR LILYPOND CODE @}
-@end example
-
-@noindent
-or
 
-@example
 @@lilypondfile[options,go,here]@{@var{filename}@}
+
+@@musicxmlfile[options,go,here]@{@var{filename}@}
 @end example
 
 Additionally, @code{@@lilypondversion} displays the current version
@@ -438,20 +486,58 @@ produces
 
 @lilypond[fragment,staffsize=11]{<c' e' g'>}
 
-Contrary to @LaTeX{}, @code{@@lilypond@{...@}} does not generate an
+Contrary to @LaTeX{}, @code{@@lilypond@{@dots{}@}} does not generate an
 in-line image.  It always gets a paragraph of its own.
 
 
 @node HTML
 @subsection HTML
 
-Music is entered using
+@code{lilypond-book} provides the following commands and environments to
+include music in HTML files:
+
+@itemize
+
+@item
+the @code{<lilypond @dots{} />} command, where you can directly enter
+short lilypond code
+
+@item
+the @code{<lilyond>@dots{}</lilypond>} environment, where you can
+directly enter longer lilypond code
+
+@item
+the @code{<lilypondfile>@dots{}</lilypondfile>} command to insert a
+lilypond file
+
+@item
+the @code{<musicxmlfile>@dots{}</musicxmlfile>} command to insert a
+MusicXML file, which will be processed by @code{musicxml2ly} and
+@code{lilypond}.
+
+@end itemize
+
+In the input file, music is specified with any of the following commands:
 
+@example
+<lilypond options go here>
+  YOUR LILYPOND CODE
+</lilypond>
+
+<lilypond options go here: YOUR LILYPOND CODE />
+
+<lilypondfile options go here>@var{filename}</lilypondfile>
+
+<musicxmlfile options go here>@var{filename}</musicxmlfile>
+@end example
+
+For example, you can write
 @example
 <lilypond fragment relative=2>
 \key c \minor c4 es g2
 </lilypond>
 @end example
+
 @noindent
 @command{lilypond-book} then produces an HTML file with appropriate image
 tags for the music fragments:
@@ -460,20 +546,25 @@ tags for the music fragments:
 \key c \minor c4 es g2
 @end lilypond
 
-For inline pictures, use @code{<lilypond ... />}, where the options
+For inline pictures, use @code{<lilypond @dots{} />}, where the options
 are separated by a colon from the music, for example
 
 @example
 Some music in <lilypond relative=2: a b c/> a line of text.
 @end example
 
-
 To include separate files, say
 
 @example
-<lilypondfile @var{option1} @var{option2} ...>@var{filename}</lilypondfile>
+<lilypondfile @var{option1} @var{option2} @dots{}>@var{filename}</lilypondfile>
 @end example
 
+@code{<musicxmlfile>} uses the same syntax as @code{<lilypondfile>}, but
+simply references a MusicXML file rather than a LilyPond file.
+
+For a list of options to use with the @code{lilypond} or
+@code{lilypondfile} tags, see @ref{Music fragment options}.
+
 Additionally, @code{<lilypondversion/>} displays the current version
 of lilypond.
 
@@ -487,7 +578,7 @@ of lilypond.
 
 For inserting LilyPond snippets it is good to keep the conformity of our
 DocBook document, thus allowing us to use DocBook editors, validation
-etc. So we don't use custom tags, only specify a convention based on the
+etc.  So we don't use custom tags, only specify a convention based on the
 standard DocBook elements.
 
 @subheading Common conventions
@@ -528,8 +619,8 @@ structure:
   <textobject>
     <programlisting language="lilypond" role="fragment verbatim staffsize=16 ragged-right relative=2">
 \context Staff \with @{
-  \remove Time_signature_engraver
-  \remove Clef_engraver@}
+  \remove "Time_signature_engraver"
+  \remove "Clef_engraver"@}
   @{ c4( fis) @}
     </programlisting>
   </textobject>
@@ -571,11 +662,9 @@ Set staff size to @var{ht}, which is measured in points.
 
 @item ragged-right
 Produce ragged-right lines with natural spacing, i.e.,
-@code{ragged-right = ##t} is added to the LilyPond snippet.  This is the
-default for the @code{\lilypond@{@}} command if no @code{line-width}
-option is present.  It is also the default for the @code{lilypond}
-environment if the @code{fragment} option is set, and no line width is
-explicitly specified.
+@code{ragged-right = ##t} is added to the LilyPond snippet.  Single-line
+snippets will always be typeset by default as ragged-right, unless
+@code{noragged-right} is explicitly given.
 
 @item noragged-right
 For single-line snippets, allow the staff length to be stretched to
@@ -596,6 +685,14 @@ If no @code{line-width} option is given, @command{lilypond-book} tries to
 guess a default for @code{lilypond} environments which don't use the
 @code{ragged-right} option.
 
+@item papersize=@var{string}
+Where @var{string} is a paper size defined in @file{scm/paper.scm} i.e.
+@code{a5}, @code{quarto}, @code{11x17} etc.
+
+Values not defined in @file{scm/paper.scm} will be ignored, a warning
+will be posted and the snippet will be printed using the default
+@code{a4} size.
+
 @item notime
 Do not print the time signature, and turns off the timing (time signature,
 bar lines) in the score.
@@ -617,7 +714,7 @@ Since this is the default, @code{nofragment} is redundant normally.
 
 @item indent=@var{size}\@var{unit}
 Set indentation of the first music system to @var{size}, using
-@var{unit} as units. @var{unit} is one of the following strings:
+@var{unit} as units.  @var{unit} is one of the following strings:
 @code{cm}, @code{mm}, @code{in}, or @code{pt}.  This option affects
 LilyPond, not the text layout.
 
@@ -696,12 +793,14 @@ as a domain.
 @item texidoc
 (Only for Texinfo output.)  If @command{lilypond} is called with the
 @option{--header=@/texidoc} option, and the file to be processed is
-called @file{foo@/.ly}, it creates a file @file{foo@/.texidoc} if there
+called @file{foo.ly}, it creates a file @file{foo.texidoc} if there
 is a @code{texidoc} field in the @code{\header}.  The @code{texidoc}
 option makes @command{lilypond-book} include such files, adding its
-contents as a documentation block right before the music snippet.
+contents as a documentation block right before the music snippet (but
+outside the @code{example} environment generated by a @code{quote}
+option).
 
-Assuming the file @file{foo@/.ly} contains
+Assuming the file @file{foo.ly} contains
 
 @example
 \header @{
@@ -729,26 +828,19 @@ Most LilyPond test documents (in the @file{input} directory of the
 distribution) are small @file{.ly} files which look exactly like this.
 
 For localization purpose, if the Texinfo document contains
-@code{@@documentlanguage @var{LANG}} and @file{foo@/.ly} header
+@code{@@documentlanguage @var{LANG}} and @file{foo.ly} header
 contains a @code{texidoc@var{LANG}} field, and if @command{lilypond}
 is called with @option{--header=@/texidoc@var{LANG}}, then
-@file{foo@/.texidoc@var{LANG}} will be included instead of
-@file{foo@/.texidoc}.
-
-@item lilyquote
-(Only for Texinfo output.)  This option is similar to quote, but only
-the music snippet (and the optional verbatim block implied by
-@code{verbatim} option) is put into a quotation block.  This option is
-useful if you want to @code{quote} the music snippet but not the
-@code{texidoc} documentation block.
+@file{foo.texidoc@var{LANG}} will be included instead of
+@file{foo.texidoc}.
 
 @item doctitle
 (Only for Texinfo output.) This option works similarly to
 @code{texidoc} option: if @command{lilypond} is called with the
 @option{--header=@/doctitle} option, and the file to be processed is
-called @file{foo@/.ly} and contains a @code{doctitle} field in the
-@code{\header}, it creates a file @file{foo@/.doctitle}.  When
-@code{doctitle} option is used, the contents of @file{foo@/.doctitle},
+called @file{foo.ly} and contains a @code{doctitle} field in the
+@code{\header}, it creates a file @file{foo.doctitle}.  When
+@code{doctitle} option is used, the contents of @file{foo.doctitle},
 which should be a single line of @var{text}, is inserted in the
 Texinfo document as @code{@@lydoctitle @var{text}}.
 @code{@@lydoctitle} should be a macro defined in the Texinfo document.
@@ -790,10 +882,10 @@ way you use, you can easily convert between PostScript and PDF with
 tools, like @command{ps2pdf} and @command{pdf2ps} included in
 Ghostscript package.
 
-To produce a PDF file through PDF@LaTeX{}, use
+To produce a PDF file through PDF@LaTeX{}, use;
 
 @example
-lilypond-book --pdf yourfile.pdftex
+lilypond-book --pdf yourfile.lytex
 pdflatex yourfile.tex
 @end example
 
@@ -801,8 +893,7 @@ pdflatex yourfile.tex
 @cindex type1 fonts
 @cindex dvips
 @cindex invoking dvips
-To produce PDF output via @LaTeX{}/@command{dvips}/@command{ps2pdf}, you
-should do
+To produce PDF output via @LaTeX{}/@command{dvips}/@command{ps2pdf};
 
 @example
 lilypond-book yourfile.lytex
@@ -812,15 +903,45 @@ ps2pdf yourfile.ps
 @end example
 
 @noindent
-The @file{.dvi} file created by this process will not contain
- note heads.  This is normal; if you follow the instructions, they
-will be included in the @file{.ps} and @file{.pdf} files.
+The @file{.dvi} file created by this process will not contain note heads.
+This is normal; if you follow the instructions, they will be included in
+the @file{.ps} and @file{.pdf} files.
 
 Running @command{dvips} may produce some warnings about fonts; these
 are harmless and may be ignored.  If you are running @command{latex} in
-twocolumn mode, remember to add @code{-t landscape} to the
+twocolumn mode, remember to add @option{-t landscape} to the
 @command{dvips} options.
 
+Environments such as;
+
+@example
+\begin@{lilypond@} @dots{} \end@{lilypond@}
+@end example
+
+@noindent
+are not interpreted by @LaTeX{}. Instead, @code{lilypond-book} extracts
+those @q{environments} into files of its own and runs LilyPond on them'.
+It then takes the resulting graphics and creates a @file{.tex} file
+where the @code{\begin@{lilypond@}}@dots{}@code{\end@{lilypond@}} macros
+are then replaced by @q{graphics inclusion} commands.  It is at this
+time that @LaTeX{} is run (although @LaTeX{} will have run previously,
+it will have been, effectively, on an @q{empty} document in order to
+calculate things like @code{\linewidth}.
+
+@knownissues
+
+The @code{\pageBreak} command will not work within a
+@code{\begin@{lilypond@} @dots{} \end@{lilypond@}} environment.
+
+Many @code{\paper} block variables will also not work within a
+@code{\begin@{lilypond@} @dots{} \end@{lilypond@}} environment.  Use
+@code{\newcommand} with @code{\betweenLilyPondSystem} in the preamble;
+
+@example
+\newcommand@{\betweenLilyPondSystem@}[1]@{\vspace@{36mm@}\linebreak@}
+@end example
+
+
 @subsubheading Texinfo
 
 To produce a Texinfo document (in any output format), follow the normal
@@ -846,7 +967,7 @@ See the documentation of Texinfo for further details.
 Specify the document type to process: @code{html}, @code{latex},
 @code{texi} (the default) or @code{docbook}.  If this option is missing,
 @command{lilypond-book} tries to detect the format automatically, see
-@ref{Filename extensions}. Currently, @code{texi} is the same as
+@ref{Filename extensions}.  Currently, @code{texi} is the same as
 @code{texi-html}.
 
 @c This complicated detail is not implemented, comment it out -jm
@@ -875,7 +996,14 @@ Add @var{dir} to the include path.  @command{lilypond-book} also looks
 for already compiled snippets in the include path, and does not write
 them back to the output directory, so in some cases it is necessary to
 invoke further processing commands such as @command{makeinfo} or
-@command{latex} with the same @code{-I @var{dir}} options.
+@command{latex} with the same @option{-I @var{dir}} options.
+
+@item -l @var{loglevel}
+@itemx --loglevel=@var{loglevel}
+Set the output verbosity to @var{loglevel}. Possible values are @code{NONE},
+@code{ERROR}, @code{WARNING}, @code{PROGRESS} (default) and @code{DEBUG}. If
+this option is not used, and the environment variable
+@code{LILYPOND_BOOK_LOGLEVEL} is set, its value is used as the loglevel.
 
 @item -o @var{dir}
 @itemx --output=@var{dir}
@@ -888,33 +1016,42 @@ before running @command{latex} or @command{makeinfo}.
 @example
 lilypond-book --output=out yourfile.lytex
 cd out
-...
+@dots{}
 @end example
 
-@itemx --skip-lily-check
+@item --skip-lily-check
 Do not fail if no lilypond output is found.  It is used for LilyPond
 Info documentation without images.
 
-@itemx --skip-png-check
+@item --skip-png-check
 Do not fail if no PNG images are found for EPS files.  It is used for
 LilyPond Info documentation without images.
 
-@itemx --lily-output-dir=@var{dir}
-Write lily-XXX files to directory @var{dir}, link into @code{--output}
+@item --lily-output-dir=@var{dir}
+Write lily-XXX files to directory @var{dir}, link into @option{--output}
 directory.  Use this option to save building time for documents in
 different directories which share a lot of identical snippets.
 
-@itemx --info-images-dir=@var{dir}
+@item --lily-loglevel=@var{loglevel}
+Set the output verbosity of the invoked @command{lilypond} calls to
+@var{loglevel}.  Possible values are @code{NONE}, @code{ERROR},
+@code{WARNING}, @code{BASIC_PROGRESS}, @code{PROGRESS}, @code{INFO}
+(default) and @code{DEBUG}.  If this option is not used, and the
+environment variable @code{LILYPOND_LOGLEVEL} is set, its value is used
+as the loglevel.
+
+
+@item --info-images-dir=@var{dir}
 Format Texinfo output so that Info will look for images of music in
 @var{dir}.
 
-@itemx --latex-program=@var{prog}
+@item --latex-program=@var{prog}
 Run executable @command{prog} instead of @command{latex}.  This is
 useful if your document is processed with @command{xelatex}, for
 example.
 
-@itemx --left-padding=@var{amount}
-Pad EPS boxes by this much. @var{amount} is measured in millimeters,
+@item --left-padding=@var{amount}
+Pad EPS boxes by this much.  @var{amount} is measured in millimeters,
 and is 3.0 by default.  This option should be used if the lines of
 music stick out of the right margin.
 
@@ -923,25 +1060,36 @@ elements that stick into the left margin, such as bar numbers and
 instrument names.  This option will shorten each line and move each
 line to the right by the same amount.
 
-
 @item -P @var{command}
 @itemx --process=@var{command}
 Process LilyPond snippets using @var{command}.  The default command is
-@code{lilypond}.  @code{lilypond-book} will not @code{--filter} and
-@code{--process} at the same time.
+@code{lilypond}.  @code{lilypond-book} will not @option{--filter} and
+@option{--process} at the same time.
 
 @item --pdf
 Create PDF files for use with PDF@LaTeX{}.
 
+@item --redirect-lilypond-output
+By default, output is displayed on the terminal.  This option redirects
+all output to log files in the same directory as the source files.
+
+@item --use-source-file-names
+Write snippet output files with the same base name as their source file.
+This option works only for snippets included with @code{lilypondfile}
+and only if directories implied by @option{--output-dir} and
+@option{--lily-output-dir} options are different.
+
 @item -V
 @itemx --verbose
-Be verbose.
+Be verbose. This is equivalent to @code{--loglevel=DEBUG}.
 
 @item -v
 @itemx --version
 Print version information.
 @end table
 
+
+
 @knownissues
 
 The Texinfo command @code{@@pagesizes} is not interpreted.  Similarly,
@@ -965,6 +1113,7 @@ selects the output format based on the input filename's extension.
 @item @strong{extension} @tab @strong{output format}
 @item
 @item @file{.html} @tab HTML
+@item @file{.htmly} @tab HTML
 @item @file{.itely} @tab Texinfo
 @item @file{.latex} @tab @LaTeX{}
 @item @file{.lytex} @tab @LaTeX{}
@@ -980,7 +1129,7 @@ selects the output format based on the input filename's extension.
 If you use the same filename extension for the input file than the
 extension @command{lilypond-book} uses for the output file, and if the
 input file is in the same directory as @command{lilypond-book} working
-directory, you must use @code{--output} option to make
+directory, you must use @option{--output} option to make
 @command{lilypond-book} running, otherwise it will exit with an error
 message like @qq{Output would overwrite input file}.
 
@@ -1005,16 +1154,14 @@ Normal LaTeX text.
 
 \begin@{lilypond@}
 \relative c'' @{
-a4 b c d
+  a4 b c d
 @}
 \end@{lilypond@}
 
-More LaTeX text.
+More LaTeX text, and options in square brackets.
 
-\begin@{lilypond@}
-\relative c'' @{
+\begin@{lilypond@}[fragment,relative=2,quote,staffsize=26,verbatim]
 d4 c b a
-@}
 \end@{lilypond@}
 \end@{document@}
 @end example
@@ -1025,16 +1172,19 @@ You can include LilyPond fragments in Texinfo; in fact, this entire manual
 is written in Texinfo.
 
 @example
-\input texinfo
+\input texinfo @c -*-texinfo-*-
 @@node Top
+@@top
 
 Texinfo text
 
-@@lilypond[verbatim,fragment,ragged-right]
-a4 b c d
+@@lilypond
+\relative c' @{
+  a4 b c d
+@}
 @@end lilypond
 
-More Texinfo text
+More Texinfo text, and options in brackets.
 
 @@lilypond[verbatim,fragment,ragged-right]
 d4 c b a
@@ -1044,6 +1194,38 @@ d4 c b a
 @end example
 
 
+@subsection html
+
+@example
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!-- header_tag -->
+<HTML>
+<body>
+
+<p>
+Documents for lilypond-book may freely mix music and text.  For
+example,
+<lilypond>
+\relative c'' @{
+  a4 b c d
+@}
+</lilypond>
+</p>
+
+<p>
+Another bit of lilypond, this time with options:
+
+<lilypond fragment quote staffsize=26 verbatim>
+a4 b c d
+</lilypond>
+</p>
+
+</body>
+</html>
+
+
+@end example
+
 @subsection xelatex
 
 @verbatim
@@ -1087,7 +1269,7 @@ and so on.
 
 The fonts of snippets set with LilyPond will have to be set from
 inside
-of the snippet. For this you should read the AU on how to use
+of the snippet.  For this you should read the AU on how to use
 lilypond-book.
 
 \selectlanguage{ngerman}
@@ -1099,65 +1281,117 @@ unterst__tzt werden.
 @end verbatim
 
 
-@node Alternate methods of mixing text and music
-@section Alternative methods of mixing text and music
-
-This section shows methods to integrate text and music, different than
-the automated method with @command{lilypond-book}.
-
-@menu
-* Many quotes from a large score::
-* Inserting LilyPond output into OpenOffice.org::
-* Inserting LilyPond output into other programs::
-@end menu
-
-@node Many quotes from a large score
-@unnumberedsubsec Many quotes from a large score
-
-If you need to quote many fragments from a large score, you can also use
-the clip systems feature, see @ruser{Extracting fragments of music}.
+@node Sharing the table of contents
+@section Sharing the table of contents
 
+These functions already exist in the OrchestralLily package:
 
-@node Inserting LilyPond output into OpenOffice.org
-@unnumberedsubsec Inserting LilyPond output into OpenOffice.org
+@example
+@url{http://repo.or.cz/w/orchestrallily.git}
+@end example
 
-@cindex OpenOffice.org
+For greater flexibility in text handling, some users prefer to
+export the table of contents from lilypond and read it into
+@LaTeX{}.
+
+@subsubheading Exporting the ToC from LilyPond
+
+This assumes that your score has multiple movements in the same lilypond
+output file.
+
+@smallexample
+#(define (oly:create-toc-file layout pages)
+  (let* ((label-table (ly:output-def-lookup layout 'label-page-table)))
+    (if (not (null? label-table))
+      (let* ((format-line (lambda (toc-item)
+             (let* ((label (car toc-item))
+                    (text  (caddr toc-item))
+                    (label-page (and (list? label-table)
+                                     (assoc label label-table)))
+                    (page (and label-page (cdr label-page))))
+               (format #f "~a, section, 1, @{~a@}, ~a" page text label))))
+             (formatted-toc-items (map format-line (toc-items)))
+             (whole-string (string-join formatted-toc-items ",\n"))
+             (output-name (ly:parser-output-name parser))
+             (outfilename (format "~a.toc" output-name))
+             (outfile (open-output-file outfilename)))
+        (if (output-port? outfile)
+            (display whole-string outfile)
+            (ly:warning (_ "Unable to open output file ~a for the TOC information") outfilename))
+        (close-output-port outfile)))))
+
+\paper @{
+  #(define (page-post-process layout pages) (oly:create-toc-file layout pages))
+@}
+@end smallexample
 
-LilyPond notation can be added to OpenOffice.org with
-@uref{http://@/ooolilypond@/.sourceforge@/.net@/,OOoLilyPond}.
+@subsubheading Importing the ToC into LaTeX
 
+In LaTeX, the header should include:
 
-@node Inserting LilyPond output into other programs
-@unnumberedsubsec Inserting LilyPond output into other programs
+@c no, this doesn't require the smallexample, but since the other
+@c two blocks on this page use it, I figured I might as well
+@c user it here as well, for consistency. -gp
+@smallexample
+\usepackage@{pdfpages@}
+\includescore@{nameofthescore@}
+@end smallexample
 
-To insert LilyPond output in other programs, use @code{lilypond}
-instead of @code{lilypond-book}.  Each example must be created
-individually and added to the document; consult the documentation for
-that program.  Most programs will be able to insert LilyPond output in
-@file{PNG}, @file{EPS}, or @file{PDF} formats.
+@noindent
+where @code{\includescore} is defined as:
+
+@smallexample
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \includescore@{PossibleExtension@}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% Read in the TOC entries for a PDF file from the corresponding .toc file.
+% This requires some heave latex tweaking, since reading in things from a file
+% and inserting it into the arguments of a macro is not (easily) possible
+
+% Solution by Patrick Fimml on #latex on April 18, 2009:
+% \readfile@{filename@}@{\variable@}
+% reads in the contents of the file into \variable (undefined if file
+% doesn't exist)
+\newread\readfile@@f
+\def\readfile@@line#1@{%
+@{\catcode`\^^M=10\global\read\readfile@@f to \readfile@@tmp@}%
+\edef\do@{\noexpand\g@@addto@@macro@{\noexpand#1@}@{\readfile@@tmp@}@}\do%
+\ifeof\readfile@@f\else%
+\readfile@@line@{#1@}%
+\fi%
+@}
+\def\readfile#1#2@{%
+\openin\readfile@@f=#1 %
+\ifeof\readfile@@f%
+\typeout@{No TOC file #1 available!@}%
+\else%
+\gdef#2@{@}%
+\readfile@@line@{#2@}%
+\fi
+\closein\readfile@@f%
+@}%
 
-To reduce the white space around your LilyPond score, use
-the following options
 
-@example
-\paper@{
-  indent=0\mm
-  line-width=120\mm
-  oddFooterMarkup=##f
-  oddHeaderMarkup=##f
-  bookTitleMarkup = ##f
-  scoreTitleMarkup = ##f
+\newcommand@{\includescore@}[1]@{
+\def\oly@@fname@{\oly@@basename\@@ifmtarg@{#1@}@{@}@{_#1@}@}
+\let\oly@@addtotoc\undefined
+\readfile@{\oly@@xxxxxxxxx@}@{\oly@@addtotoc@}
+\ifx\oly@@addtotoc\undefined
+\includepdf[pages=-]@{\oly@@fname@}
+\else
+\edef\includeit@{\noexpand\includepdf[pages=-,addtotoc=@{\oly@@addtotoc@}]
+@{\oly@@fname@}@}\includeit
+\fi
 @}
+@end smallexample
 
-@{ c1 @}
-@end example
 
-To produce a useful @file{EPS} file, use
+@node Alternate methods of mixing text and music
+@section Alternative methods of mixing text and music
 
-@example
-lilypond -dbackend=eps -dno-gs-load-fonts -dinclude-eps-fonts   myfile.ly
+Other means of mixing text and music (without
+@command{lilypond-book}) are discussed in
+@ref{LilyPond output in other programs}.
 
-@file{PNG}:
-lilypond -dbackend=eps -dno-gs-load-fonts -dinclude-eps-fonts --png myfile.ly
-@end example