Music fragment options - GNU LilyPond
Description: GNU LilyPond

Next: Invoking lilypond-book, Previous: Integrating HTML and music, Up: LilyPond-book

### 13.5 Music fragment options

In the following, a “LilyPond command” refers to any command described in the previous sections which is handled by `lilypond-book` to produce a music snippet. For simplicity, LilyPond commands are only shown in LaTeX syntax.

Note that the option string is parsed from left to right; if an option occurs multiple times, the last one is taken.

The following options are available for LilyPond commands:

`staffsize=`ht
  Set staff size to ht, which is measured in points.
`ragged-right`
  Produce ragged-right lines with natural spacing (i.e., `ragged-right = ##t` is added to the LilyPond snippet). This is the default for the `\lilypond{}` command if no `line-width` option is present. It is also the default for the `lilypond` environment if the `fragment` option is set, and no line width is explicitly specified.
`packed`
  Produce lines with packed spacing (i.e., `packed = ##t` is added to the LilyPond snippet).
`line-width`
`line-width=`size`\`unit
  Set line width to size, using unit as units. unit is one of the following strings: `cm`, `mm`, `in`, or `pt`. This option affects LilyPond output (this is, the staff length of the music snippet), not the text layout.

  If used without an argument, set line width to a default value (as computed with a heuristic algorithm).

  If no `line-width` option is given, `lilypond-book` tries to guess a default for `lilypond` environments which don't use the `ragged-right` option.

`notime`
  Do not print the time signature, and turns off the timing (key signature, bar lines) in the score.
`fragment`
  Make `lilypond-book` add some boilerplate code so that you can simply enter, say,

           c'4

  without `\layout`, `\score`, etc.

`nofragment`
  Don't add additional code to complete LilyPond code in music snippets. Since this is the default, `nofragment` is redundant normally.
`indent=`size`\`unit
  Set indentation of the first music system to size, using unit as units. unit is one of the following strings: `cm`, `mm`, `in`, or `pt`. This option affects LilyPond, not the text layout.
`noindent`
  Set indentation of the first music system to zero. This option affects LilyPond, not the text layout. Since no indentation is the default, `noindent` is redundant normally.
`quote`
  Reduce line length of a music snippet by 2*0.4in and put the output into a quotation block. The value `0.4in' can be controlled with the `exampleindent` option.
`exampleindent`
  Set the amount by which the `quote` option indents a music snippet.
`relative`
`relative=`n
  Use relative octave mode. By default, notes are specified relative to middle C. The optional integer argument specifies the octave of the starting note, where the default `1` is middle C.

LilyPond also uses `lilypond-book` to produce its own documentation. To do that, some more obscure music fragment options are available.

`verbatim`
  The argument of a LilyPond command is copied to the output file and enclosed in a verbatim block, followed by any text given with the `intertext` option (not implemented yet); then the actual music is displayed. This option does not work well with `\lilypond{}` if it is part of a paragraph.
`texidoc`
  (Only for Texinfo output.) If `lilypond` is called with the `--header=texidoc` option, and the file to be processed is called `foo.ly`, it creates a file `foo.texidoc` if there is a `texidoc` field in the `\header`. The `texidoc` option makes `lilypond-book` include such files, adding its contents as a documentation block right before the music snippet.

  Assuming the file `foo.ly` contains

           \header {
             texidoc = "This file demonstrates a single note."
           }
           { c'4 }

  and we have this in our Texinfo document `test.texinfo`

           @lilypondfile[texidoc]{foo.ly}

  the following command line gives the expected result

           lilypond-book --process="lilypond --format=tex --tex \
                         --header=texidoc test.texinfo

  Most LilyPond test documents (in the `input` directory of the distribution) are small `.ly` files which look exactly like this.

`printfilename`
  If a LilyPond input file is included with `\lilypondfile`, print the file name right before the music snippet. For HTML output, this is a link.
`fontload`
  This option includes fonts in all of the generated EPS-files for this snippet. This should be used if the snippet uses any font that LaTeX cannot find on its own.

This page is for LilyPond-2.8.8 (stable-branch).

Other languages: English.
Using automatic language selection.