Lilypond Usage: The Lilypond Development Team
Lilypond Usage: The Lilypond Development Team
Lilypond Usage: The Lilypond Development Team
☛ ✟
This file explains how to execute the programs distributed with LilyPond version 2.21.6. In
addition, it suggests some “best practices” for efficient usage.
✡ ✠
☛ ✟
For more information about how this manual fits with the other documentation, or to read this
manual in other formats, see Section “Manuals” in General Information.
If you are missing any manuals, the complete documentation can be found at
http://lilypond.org/.
✡ ✠
Table of Contents
1 Running lilypond . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Normal usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Command-line usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Invoking lilypond . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Using LilyPond with standard shell features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Basic command line options for LilyPond . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Advanced command line options for LilyPond . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Environment variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Relocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Relocation files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Relocation algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
LilyPond in chroot jail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.3 Error messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.4 Common errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Music runs off the page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
An extra staff appears . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Error message Unbound variable % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Error message FT Get Glyph Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Warning staff affinities should only decrease . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Error message unexpected \new . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Warning this voice needs a \voiceXx or \shiftXx setting . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3 Running lilypond-book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.1 An example of a musicological document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.2 Integrating music and text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.2.1 LATEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.2.2 Texinfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.2.3 HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.2.4 DocBook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.3 Music fragment options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.4 Invoking lilypond-book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.5 Filename extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
3.6 lilypond-book templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
3.6.1 LaTeX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
3.6.2 Texinfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.6.3 html . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.6.4 xelatex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.7 Sharing the table of contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
3.8 Alternative methods of mixing text and music . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
ii
4 External programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.1 Point and click . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.1.1 Configuring the system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Using Xpdf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Using GNOME 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Using GNOME 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Extra configuration for Evince . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Enabling point and click . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Selective point-and-click . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
4.2 Text editor support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Emacs mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Vim mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Other editors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
4.3 Converting from other formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
4.3.1 Invoking midi2ly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
4.3.2 Invoking musicxml2ly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
4.3.3 Invoking abc2ly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
4.3.4 Invoking etf2ly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4.3.5 Other formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4.4 LilyPond output in other programs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4.4.1 LuaTex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4.4.2 OpenOffice and LibreOffice. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4.4.3 Other programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
4.5 Independent includes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
4.5.1 MIDI articulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
1 Running lilypond
This chapter details the technicalities of running LilyPond.
Invoking lilypond
The lilypond executable may be called as follows from the command line.
lilypond [option]... file...
When invoked with a filename that has no extension, the .ly extension is tried first. To read
input from stdin, use a dash (-) for file.
When filename.ly is processed it produces filename.pdf as output by default. Several
files can be specified; they are each processed independently.1
If filename.ly contains more than one \book block, the rest of the scores is output in
numbered files, starting with filename-1.pdf. In addition, the value of output-suffix is
inserted between the basename and the number. For example, if filename.ly contains
#(define output-suffix "violin")
\score { ... }
#(define output-suffix "cello")
\score { ... }
LilyPond outputs filename-violin.pdf and filename-cello-1.pdf.
SVG internally uses a specific backend, and therefore cannot be obtained in the
same run as other formats; using -fsvg or --svg is actually equivalent to using the
-dbackend=svg option. See [Advanced command line options for LilyPond], page 5.
-h, --help
Show a summary of usage.
-H, --header=field
Dump a header field to file BASENAME.field.
As an example, let’s assume that you have an input file foo.ly containing
\header { title = "bar" }
\score { c1 }
The command
lilypond -H title foo.ly
then creates a plain text file foo.title containing the string bar.
-i, --init=file
Set init file to file (default: init.ly).
-I, --include=directory
Append directory to the search path for input files with relative paths. By default,
only the current working directory gets searched.
Multiple -I options may be given. The search starts in the current working directory,
and if the file to be included is not found the search continues in the directory given
by the first -I option, then the directory in the second -I option, and so on.
☛ ✟
Note: Using the tilde character (~) with the -I switch may
produce unexpected results in some shells.
Windows users need to include a trailing slash for the di-
rectory’s path.
✡ ✠
-j, --jail=user,group,jail,dir
[This option is only available if your operating system supports the chroot func-
tionality. In particular, Windows doesn’t support it.]
Run lilypond in a chroot jail.
The --jail option provides a more flexible alternative to -dsafe, when LilyPond
formatting is being provided via a web server, or whenever LilyPond executes com-
mands sent by external sources (see [Advanced command line options for LilyPond],
page 5).
It works by changing the root of lilypond to jail just before starting the actual
compilation process. The user and group are then changed to match those provided,
and the current directory is changed to dir. This setup guarantees that it is not
possible (at least in theory) to escape from the jail. Note that for --jail to work,
lilypond must be run as root, which is usually accomplished in a safe way using
sudo.
Setting up a jail can be a relatively complex matter, as we must be sure that
LilyPond is able to find whatever it needs to compile the source inside the jail itself.
A typical chroot jail comprises the following steps:
Setting up a separate filesystem
A separate filesystem should be created for LilyPond, so that it can be
mounted with safe options such as noexec, nodev, and nosuid. In this
Chapter 1: Running lilypond 4
is the same as
-dno-point-and-click
[Note that the ‘#’ character introduces a comment in many shells. For this reason it is
recommended to always quote expressions that contain it.]
The following table lists all supported option names together with its values. Within Scheme
code, option values can be read using function ly:get-option.
anti-alias-factor num
Render at a higher resolution (using factor num, which must be a positive integer
≤8) and scale down the result to prevent ‘jaggies’ in PNG images. Default: 1.
aux-files bool
If bool is #t, create .tex, .texi, and .count files when used with the eps backend
option. Default: #t.
backend symbol
Use symbol as the backend for LilyPond output. Possible values are:
ps This is the default setting. PostScript files include TTF, Type1, and
OTF fonts. No ‘subsetting’ of these fonts is done. Be aware that using
‘oriental’ character sets like Japanese can lead to very large file sizes.
For PDF output, the ps backend is used, too; the resulting PS data
is post-processed by Ghostscript’s ps2pdf script, which also does font
subsetting by default.
eps Used as the default by the lilypond-book command. This dumps
every page as both a single file with all pages and fonts included and as
separate encapsulated PostScript files for each page but without fonts
included.
null Do not output a printed score. This has the same effect as
-dno-print-pages.
scm This dumps out the raw, internal Scheme-based drawing commands.
svg Scalable Vector Graphics. A single SVG file is created for every page of
output. Music glyphs are encoded as vector graphics, but text fonts are
not embedded in the SVG files. Any SVG viewer will therefore need the
relevant text fonts to be available to it for proper rendering of both text
and lyrics. It is recommended to not use font ‘lists’ or ‘aliases’ in case
an SVG viewer is unable to handle them. When using Web Open Font
Format (WOFF) files the additional -dsvg-woff switch is required.
check-internal-types bool
If bool is #t, check every property assignment for types. Default: #f.
clip-systems bool
If bool is #t, extract music fragments out of a score. This requires that the
clip-regions function has been defined within the \layout block. See Section
“Extracting fragments of music” in Notation Reference. No fragments are extracted
though if used with the -dno-print-pages option. Default: #f.
crop bool If bool is #t, fit all the music and headers, without margins, into a ‘single-page’
output file. Default: #f.
datadir Prefix for data files. This is a read-only option; setting it has no effect.
debug-gc bool
If bool is #t, dump memory debugging statistics. Default: #f.
Chapter 1: Running lilypond 7
debug-gc-assert-parsed-dead bool
For memory debugging: If bool is #t, ensure that all references to parsed objects are
dead. This is an internal option, and is switched on automatically for -ddebug-gc.
Default: #f.
debug-lexer bool
If bool is #t, debug the flex lexer. Default: #f.
debug-page-breaking-scoring bool
If bool is #t, dump scores for many different page breaking configurations. Default:
#f.
debug-parser bool
If bool is #t, debug the bison parser. Default: #f.
debug-property-callbacks bool
If bool is #t, debug cyclic callback chains. Default: #f.
debug-skylines bool
If bool is #t, debug skylines. Default: #f.
delete-intermediate-files bool
If bool is #t, delete the unusable, intermediate .ps files created during compilation.
Default: #t.
dump-signatures bool
If bool is #t, dump output signatures of each system. Used for regression testing.
Default: #f.
embed-source-code bool
If bool is #t, embed the LilyPond source files inside the generated PDF document.
Default: #f.
eps-box-padding num
Pad left edge of the output EPS bounding box by num millimeters. Default: #f
(meaning no bounding box padding).
font-export-dir string
Set directory for exporting fonts as PostScript files to string. This is useful when
you want to create a PDF without embedded fonts first and later embed the fonts
with Ghostscript as shown below.
$ lilypond -dfont-export-dir=fontdir -dgs-never-embed-fonts foo.ly
$ gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite \
-sOutputFile=foo.embedded.pdf foo.pdf fontdir/*.font.ps
Note: Unlike font-ps-resdir, this method cannot embed CID fonts with Ghost-
script 9.26 and later.
Note: Same as font-ps-resdir, this option skips TrueType fonts because embed-
ding TrueType fonts later causes garbled characters. To avoid garbling characters,
use gs-never-embed-fonts, as this embeds TrueType fonts despite its name.
Default: #f (meaning not to export).
font-ps-resdir string
Set directory (as string) to build a subset of the PostScript resource directory to
be used for embedding fonts later. This is useful when you want to create a PDF
without embedded fonts first and later embed the fonts with Ghostscript as shown
below.
$ lilypond -dfont-ps-resdir=resdir -dgs-never-embed-fonts foo.ly
Chapter 1: Running lilypond 8
midi-extension string
Set the default file extension for MIDI output files to .string. Default: "midi".
music-strings-to-paths bool
If bool is #t, convert text strings to paths when glyphs belong to a music font.
Default: #f.
paper-size extra-quoted-string
Set default paper size to extra-quoted-string. Note that the string must be enclosed
in escaped double quotes. Default: "\"a4\"".
pixmap-format symbol
Set Ghostscript’s output format for pixel images to symbol. Default: png16m.
png-width width
png-height height
For PNG output, set the width and height (in pixels) of the created image file. If
one of the options is missing, the other dimension is computed according to the EPS
bounding box, retaining the aspect ratio.
In addition to --png, either --eps, -dcrop, or -dpreview should be used to get
proper image scaling without clipping.
Option -dresolution is ignored.
Note that there is a bug in ghostscript versions up to 9.52 for these two options: It
produces empty PNG images if the height is larger than the width.
point-and-click bool
If bool is #t, add ‘point & click’ links to PDF and SVG output. See Section 4.1
[Point and click], page 43. Default: #t.
preview bool
If bool is #t, create preview images in addition to normal output. Default: #f.
This option is supported by all backends (pdf, png, ps, eps, and svg) except scm.
For input file name file and backend format, it generates an output file having the
name file.preview.format, containing the titles and the first system of music. If
\book or \bookpart blocks are used, the titles of \book, \bookpart or \score will
appear in the output, including the first system of every \score block if the \paper
variable print-all-headers is set to #t.
To suppress the usual output, use the -dprint-pages or -dno-print-pages options
according to your requirements.
print-pages bool
If bool is #t, generate full pages. Default: #t.
Option -dno-print-pages is useful in combination with -dpreview or -dcrop.
profile-property-accesses bool
If bool is #t, keep statistics of get_property() function calls. Default: #f.
protected-scheme-parsing bool
If bool is #t, continue when errors in inline Scheme code are caught in the parser.
If set to #f, halt on errors and print a stack trace. Default: #t.
read-file-list string
Use file string that contains a list of input files to be processed. Default: #f
(meaning no input list file).
Chapter 1: Running lilypond 10
relative-includes bool
When processing an \include command, look for the included file relative to the
current file if bool is #t. If set to #f, look for the file relative to the root file. Default:
#t.
resolution num
Set resolution for generating PNG pixmaps to num dpi. Default: 101.
safe bool If bool is #t, do not trust the .ly input. Default: #f.
When LilyPond formatting is available through a web server, either the -dsafe or
the --jail option MUST be passed. The -dsafe option prevents inline Scheme
code from wreaking havoc, e.g.,
% too dangerous to write correctly
#(s ystem "rm -rf /")
% malicious but not destructive
{ c4^$(ly:gulp-file "/etc/passwd") }
The -dsafe option works by evaluating in-line Scheme expressions in a special safe
module. This is derived from GUILE’s safe-r5rs module, but also adds a number
of functions of the LilyPond API which are listed in scm/safe-lily.scm.
In addition, safe mode disallows \include directives and disables the use of back-
slashes in TEX strings. It is also not possible to import LilyPond variables into
Scheme while in safe mode.
Option -dsafe does not detect resource overuse, so it is still possible to make
the program hang indefinitely, for example by feeding cyclic data structures into
the backend. Therefore, if using LilyPond on a publicly accessible webserver, the
process should be limited in both CPU and memory usage.
Safe mode will prevent many useful LilyPond snippets from being compiled.
Option --jail is an even more secure alternative, but requires more work to set
up. See [Basic command line options for LilyPond], page 2.
separate-log-files bool
For input files file1.ly, file2.ly, . . . , output log data to files file1.log,
file2.log, . . . , if bool is #t. Default: #f.
show-available-fonts bool
If bool is #t, list available font names as delivered by the fontconfig library. Ap-
pended to this list LilyPond displays the configuration settings of fontconfig itself.
Default: #f.
strict-infinity-checking bool
If bool is #t, make lilypond abort on encountering Inf and NaN floating point
exceptions. Default: #f.
strip-output-dir bool
If bool is #t, don’t use the directory part from input file paths while constructing
output file names. Default: #t.
strokeadjust bool
If bool is #t, force PostScript stroke adjustment. This option is mostly relevant
when a PDF is generated from PostScript output (stroke adjustment is usually
enabled automatically for low-resolution bitmap devices). Without this option, PDF
previewers tend to produce widely inconsistent stem widths at resolutions typical
for screen display. However, the option does not noticeably affect print quality and
causes large file size increases in PDF files. Default: #f.
Chapter 1: Running lilypond 11
svg-woff bool
This option is required when using Web Open Font Format (WOFF) font files with
the svg backend. If bool is #t, a single SVG file is created for every page of output.
Apart from LilyPond’s own music glyphs, no other font information will be included.
Any SVG viewer will therefore require the fonts be available to it for the proper
rendering of both text and lyrics. It is also recommended not to use any font
‘aliases’ or ‘lists’ in case the SVG viewer cannot handle them. Default: #f.
verbose Verbosity level. This is a read-only option; setting it has no effect.
warning-as-error bool
If bool is #t, change all warning and ‘programming error’ messages into errors.
Default: #f.
Environment variables
lilypond recognizes the following environment variables:
LILYPOND_DATADIR
This specifies a directory where locale messages and data files are looked up by
default, overriding locations defined either at compile-time or computed dynamically
at run-time (see [Relocation], page 11). The directory should contain subdirectories
called ly, ps, tex, etc.
LILYPOND_LOCALEDIR
Specify the directory where locale-specific files are located. This overrides the value
derived from LILYPOND_DATADIR.
LILYPOND_RELOCDIR
Specify the directory where relocation files are located. This overrides the value
derived from the location of the lilypond binary.
LANG The language for LilyPond data sent to stdout and stderr, for example progress
reports, warning messages, or debug output. Example: LANG=de.
LILYPOND_LOGLEVEL
The default loglevel. If LilyPond is called without an explicit loglevel (i.e., no
--loglevel command line option), this value is used.
LILYPOND_GC_YIELD
A variable, as a percentage, that tunes memory management behavior. A higher
values means the program uses more memory, a smaller value means more CPU
time is used. The default value is 70.
TMPDIR This specifies the temporary directory in GNU/Linux and Mac. Default is /tmp. It
is the directory where intermediate files (such as PostScript files) are saved during
compilation. Overriding this variable might be useful, for example, if the user
running lilypond does not have write access to the default temporary directory.
Example: TMPDIR=~/foo.
Relocation
Most programs in the Unix world use default directories for its data that are determined at
configure time before compilation. LilyPond is no exception; for example, a typical installation
puts the lilypond binary into /usr/bin and all files specific to LilyPond into subdirectories of
/usr/share/lilypond/2.21.0/ (assuming that the current version is 2.21.0).
While this approach works fine for manual compilation and platforms that come with stan-
dardized package managers, it can cause issues where such managers are not common or not
Chapter 1: Running lilypond 12
used by default. Typical examples of such platforms are Windows and MacOS, where users
expect that application bundles can be installed anywhere.
The common solution to this problem is relocation support: Instead of using hard-coded
paths to data files, locations of the necessary support files are computed at run time relative to
the executed binary.
Relocation files
There’s actually a second mechanism for run-time configuration: LilyPond heavily relies on
external programs and libraries, in particular the ‘FontConfig’ and ‘GUILE’ libraries to find
system fonts and handle Scheme files, respectively, and the gs program to convert PS data to
PDF files. All of them must be configured also to locate its relevant data files. To do that, the
lilypond program parses all files in a directory called relocate (if it exists; see below where
this directory is searched for) to manipulate environment variables, which in turn control those
external libraries and programs. The format of such relocation files is simple; each line has the
syntax
command key=value
and empty lines get ignored.
The command directive is one of the following.
set Uncondionally set environment variable key to value. This overrides a previously
set value.
set? Set environment variable key to value only if key isn’t defined yet. In other words,
it doesn’t override a previously set value.
setdir If value is a directory, unconditionally set environent variable key to value. Other-
wise, emit a warning.
setfile If value is a file, unconditionally set environent variable key to value. Otherwise,
emit a warning.
prependdir
Prepend directory value to the list of directories in environment variable key. If key
doesn’t exist it gets created.
Environment variables (marked with a leading dollar sign) are allowed in value and get
expanded before the directive is executed.
Here are two examples of relocation file entries, taken from GUB (see Section “Grand Unified
Builder (GUB)” in Contributor’s Guide).
set? FONTCONFIG_FILE=$INSTALLER_PREFIX/etc/fonts/fonts.conf
prependdir GUILE_LOAD_PATH=$INSTALLER_PREFIX/share/guile/1.8
Multiple lines setting the same environment variable should be avoided in relocation files
since the parsing order of files in the relocate directory is arbitrary.
Relocation algorithm
LilyPond uses the following algorithm to find its data files.
1. Compute the directory where the currently executed lilypond binary is located. Let’s call
this bindir. Set (internal) environment variable INSTALLER_PREFIX to bindir/.. (i.e., the
parent directory of bindir).
2. Check environment variable LILYPOND_DATADIR. If it is set, use its value for LilyPond’s
data directory, datadir. Otherwise use either $INSTALLER_PREFIX/share/lilypond/
version (with version being the current LilyPond version) or $INSTALLER_PREFIX/share/
lilypond/current.
Chapter 1: Running lilypond 13
3. Check environment variable LILYPOND_LOCALEDIR. If it is set, use its value for LilyPond’s
locale data directory, localedir. Otherwise use $INSTALLER_PREFIX/share/locale.
4. Check environment variable LILYPOND_RELOCDIR. If it is set, use its value for the directory of
LilyPond’s relocation files, relocdir. Otherwise use $INSTALLER_PREFIX/etc/relocate.
5. If datadir doesn’t exist, use a compile-time value instead. Ditto for localedir (but not
for relocdir, since it doesn’t make sense to have that).
6. If relocdir exists, process all files in this directory as described in [Relocation files], page 12.
username=lily
home=/home
loopdevice=/dev/loop0
jaildir=/mnt/lilyloop
# the prefix (without the leading slash!)
lilyprefix=usr/local
# the directory where lilypond is installed on the system
Chapter 1: Running lilypond 14
lilydir=/$lilyprefix/lilypond/
userhome=$home/$username
loopfile=$userhome/loopfile
adduser $username
dd if=/dev/zero of=$loopfile bs=1k count=200000
mkdir $jaildir
losetup $loopdevice $loopfile
mkfs -t ext3 $loopdevice 200000
mount -t ext3 $loopdevice $jaildir
mkdir $jaildir/lilyhome
chown $username $jaildir/lilyhome
cd $jaildir
cp -r -L $lilydir $lilyprefix
cp -L /bin/sh /bin/rm bin
cp -L /usr/bin/convert /usr/bin/gs usr/bin
cp -L /usr/share/fonts/truetype usr/share/fonts
Scheme error
Errors that occur while executing Scheme code are caught by the Scheme inter-
preter. If running with the verbose option (-V or --verbose) then a call trace of
the offending function call is printed.
Programming error
There was some internal inconsistency. These error messages are intended to help
the programmers and debuggers. Usually, they can be ignored. Sometimes, they
come in such big quantities that they obscure other output.
Aborted (core dumped)
This signals a serious programming error that caused the program to crash. Such
errors are considered critical. If you stumble on one, send a bug-report.
If warnings and errors can be linked to some part of the input file, then error messages have
the following form
filename:lineno:columnno: message
offending input line
A line-break is inserted in the offending line to indicate the column where the error was
found. For example,
test.ly:2:19: error: not a duration: 5
{ c'4 e'
5 g' }
These locations are LilyPond’s best guess about where the warning or error occurred, but
(by their very nature) warnings and errors occur when something unexpected happens. If you
can’t see an error in the indicated line of your input file, try checking one or two lines above the
indicated position.
Please note that diagnostics can be triggered at any point during the many stages of process-
ing. For example if there are parts of the input that are processed multiple times (i.e. in midi
and layout output), or if the same music variable is used in multiple contexts the same message
may appear several times. Diagnostics produced at a ‘late’ stage (i.e bar checks) might also be
issued multiple times.
More information about errors is given in Section 1.4 [Common errors], page 15.
The incorrect duration can be found easily if bar checks are used, see Section “Bar and bar
number checks” in Notation Reference.
If you actually intend to have a series of such carry-over measures you will need to insert
an invisible bar line where you want the line to break. For details, see Section “Bar lines” in
Notation Reference.
º
º o
This is because a Staff context does not exist when the override is processed, so one is
implicitly created and the override is applied to it, but then the \new Staff command creates
another, separate, staff into which the notes are placed. The correct code to color all note heads
red is
\new Staff {
\override Staff.NoteHead.color = #red
a'
}
º o
Error message Unbound variable %
This error message will appear at the bottom of the console output or log file together with a
“GUILE signalled an error . . . ” message every time a Scheme routine is called which (invalidly)
contains a LilyPond rather than a Scheme comment.
LilyPond comments begin with a percent sign, (%), and must not be used within Scheme
routines. Scheme comments begin with a semi-colon, (;).
º o o o o
º o o o o
but more likely you should be using double angle brackets so the new staves are introduced in
parallel, i.e. simultaneously:
\score {
<<
\new Staff { a' a' a' a' }
\new Staff { g' g' g' g' }
>>
}
º o o o o
º o o o o
Chapter 1: Running lilypond 18
See also
Section “Explicitly instantiating voices” in Learning Manual, Section “Real music example”
in Learning Manual, Section “Single-staff polyphony” in Notation Reference, Section “Collision
resolution” in Notation Reference.
19
When run, the convert-ly command will output the version numbers of which conversions
have been made to. If no version numbers are listed in the output for the file, it is already up
to date and using the latest LilyPond syntax.
☛ ✟
Note: For each new version of LilyPond, a new convert-ly command
is created, however not every version of LilyPond will need syntax
changes for its input files from the version before. This means that
the convert-ly command will only convert input files up to the latest
syntax change it has and this, in turn, may mean that the \version
number left in the upgraded input file is sometimes earlier than the
version of convert-ly command itself.
✡ ✠
To convert all input files in a single directory use;
convert-ly -e *.ly
Linux and MacOS X users can both use the appropriate terminal application, but MacOS X
users can also execute this command directly under the menu entry Compile > Update syntax.
A Windows user would run the command;
convert-ly.py -e *.ly
entering these commands in a command prompt usually found under Start > Accessories >
Command Prompt or for version 8 users, by typing in the search window ‘command prompt’.
To convert all input files that reside in different sets of subdirectories;
find . -name '*.ly' -exec convert-ly -e '{}' \;
This example searches and converts all input files in the current directory and all directories
below it recursively. The converted files will be located in the same directory along with their
renamed originals. This should also work for MacOS X users, although only via the terminal
app.
Windows user would use;
forfiles /s /M *.ly /c "cmd /c convert-ly.py -e @file"
Alternatively, an explicit path to the top-level of your folder containing all the sub-folders
that have input files in them can be stated using the /p option;
forfiles /s /p C:\Documents\MyScores /M *.ly /c "cmd /c convert-ly.py -e @file"
If there are spaces in the path to the top-level folder, then the whole path needs to be inside
double quotes;
forfiles /s /p "C:\Documents\My Scores" /M *.ly /c "cmd /c convert-ly.py -e @file"
-e, --edit
Apply the conversions direct to the input file, modifying it in-place. The original file
is renamed as myfile.ly~. This backup file may be a hidden file on some operating
systems. Alternatively, if you want to specify a different name for the upgraded file
without using the -e options default ~ appended to the old input file, the output
can be redirected instead;
convert-ly myfile.ly > mynewfile.ly
Windows user would use;
convert-ly.py myfile.ly > mynewfile.ly
-b, --backup-numbered
When used with the ‘-e’ option, number the backup files so that no previous version
is overwritten. The backup files may be hidden on some operating systems.
-f, --from=from-patchlevel
Set the version to convert from. If this is not set, convert-ly will guess this, on
the basis of \version strings in the file. E.g. --from=2.10.25
-h, --help
Print usage help.
-l loglevel, --loglevel=loglevel
Set the output verbosity to loglevel. Possible values, in upper case, are PROGRESS
(the default), NONE, WARNING, ERROR and DEBUG.
-n, --no-version
Normally, convert-ly adds a \version indicator to the output. Specifying this
option suppresses this.
-s, --show-rules
Show all known conversions and exit.
-t, --to=to-patchlevel
Explicitly set which \version to convert to, otherwise the default is the most current
value. It must be higher than the starting version.
convert-ly --to=2.14.1 myfile.ly
To upgrade LilyPond fragments in texinfo files, use
convert-ly --from=... --to=... --no-version *.itely
To see the changes in the LilyPond syntax between two versions, use
convert-ly --from=... --to=... -s
Not all language changes are handled. Only one output option can be specified. Automat-
ically updating scheme and LilyPond scheme interfaces is quite unlikely; be prepared to tweak
scheme code manually.
1
At least, this is possible in any LilyPond file which does not contain scheme. If there is scheme in the file, then
the LilyPond file contains a Turing-complete language, and we run into problems with the famous “Halting
Problem” in computer science.
Chapter 2: Updating files with convert-ly 23
3 Running lilypond-book
If you want to add pictures of music to a document, you can simply do it the way you would do
with other types of pictures. The pictures are created separately, yielding PostScript output or
PNG images, and those are included into a LATEX or HTML document.
lilypond-book provides a way to automate this process: This program extracts snippets of
music from your document, runs lilypond on them, and outputs the document with pictures
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 lilypond itself, and is run on the command line; for
more information, see Section 1.2 [Command-line usage], page 1. If you have trouble run-
ning lilypond-book on Windows or Mac OS X using the command line, then see either Section
“Windows” in General Information or Section “MacOS X” in General Information.
This procedure may be applied to LATEX, HTML, Texinfo or DocBook documents.
Input
\documentclass[a4paper]{article}
\begin{document}
\begin{lilypond}
\relative {
c'2 e2 \tuplet 3/2 { f8 a b } a2 e4
}
\end{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-and-boink.ly}
\end{document}
Processing
Save the code above to a file called lilybook.lytex, then in a terminal run
lilypond-book --output=out --pdf lilybook.lytex
lilypond-book (GNU LilyPond) 2.21.6
Reading lilybook.lytex...
...lots of stuff deleted...
Compiling lilybook.tex...
cd out
pdflatex lilybook
...lots of stuff deleted...
xpdf lilybook
(replace xpdf by your favorite PDF viewer)
Running lilypond-book and latex creates a lot of temporary files, which would clutter up
the working directory. To remedy this, use the --output=dir option. It will create the files in
a separate subdirectory dir.
Finally the result of the LATEX example shown above.1 This finishes the tutorial section.
1
This tutorial is processed with Texinfo, so the example gives slightly different results in layout.
Chapter 3: Running lilypond-book 26
Output
Documents for lilypond-book may freely mix music and text. For example,
º \ ooo\
3
\ o
c'4 f16
º v
o o
Larger examples can be put into a separate file, and introduced with \lilypondfile.
o o o u o o oo o w
oo N N o oo
48 o oo o
r o
4 o N o oo o o
3
8 lll ooo
n o
If a tagline is required, either default or custom, then the entire snippet must be enclosed
in a \book { } construct.
\book{
\header{
title = "A scale in LilyPond"
}
\relative {
c' d e f g a b c
}
}
Chapter 3: Running lilypond-book 27
A scale in LilyPond
º oooo oooo
3.2.1 LATEX
LATEX is the de-facto standard for publishing layouts in the exact sciences. It is built on top of
the TEX typesetting engine, providing the best typography available anywhere.
See The Not So Short Introduction to LATEX (http://www.ctan.org/tex-archive/info/
lshort/english/) for an overview on how to use LATEX.
lilypond-book provides the following commands and environments to include music in LATEX
files:
• the \lilypond{...} command, where you can directly enter short lilypond code
• the \begin{lilypond}...\end{lilypond} environment, where you can directly enter
longer lilypond code
• the \lilypondfile{...} command to insert a lilypond file
• the \musicxmlfile{...} command to insert a MusicXML file, which will be processed by
musicxml2ly and lilypond.
In the input file, music is specified with any of the following commands:
\begin{lilypond}[options,go,here]
YOUR LILYPOND CODE
\end{lilypond}
\lilypondfile[options,go,here]{filename}
\musicxmlfile[options,go,here]{filename}
Additionally, \lilypondversion displays the current version of lilypond. Running
lilypond-book yields a file that can be further processed with LATEX.
We show some examples here. The lilypond environment
\begin{lilypond}[quote,fragment,staffsize=26]
c' d' e' f' g'2 g'2
\end{lilypond}
produces
º
o o o o \ \
The short version
\lilypond[quote,fragment,staffsize=11]{<c' e' g'>}
produces
º oo
o
Currently, you cannot include { or } within \lilypond{}, so this command is only useful with
the fragment option.
Chapter 3: Running lilypond-book 29
The default line width of the music will be adjusted by examining the commands in the
document preamble, the part of the document before \begin{document}. The lilypond-book
command sends these to LATEX to find out how wide the text is. The line width for the music
fragments is then adjusted to the text width. Note that this heuristic algorithm can fail easily;
in such cases it is necessary to use the line-width music fragment option.
Each snippet will call the following macros if they have been defined by the user:
• \preLilyPondExample called before the music,
• \postLilyPondExample called after the music,
• \betweenLilyPondSystem[1] is called between systems if lilypond-book has split the
snippet into several PostScript files. It must be defined as taking one parameter and will be
passed the number of files already included in this snippet. The default is to simply insert
a \linebreak.
Selected Snippets
Sometimes it is useful to display music elements (such as ties and slurs) as if they continued
after the end of the fragment. This can be done by breaking the staff and suppressing inclusion
of the rest of the LilyPond output.
In LATEX, define \betweenLilyPondSystem in such a way that inclusion of other systems is
terminated once the required number of systems are included. Since \betweenLilyPondSystem
is first called after the first system, including only the first system is trivial.
\def\betweenLilyPondSystem#1{\endinput}
\begin{lilypond}[fragment]
c'1\( e'( c'~ \break c' d) e f\)
\end{lilypond}
If a greater number of systems is requested, a TEX conditional must be used before the
\endinput. In this example, replace ‘2’ by the number of systems you want in the output.
\def\betweenLilyPondSystem#1{
\ifnum#1<2\else\expandafter\endinput\fi
}
(Since \endinput immediately stops the processing of the current input file we need
\expandafter to delay the call of \endinput after executing \fi so that the \if-\fi clause is
balanced.)
Remember that the definition of \betweenLilyPondSystem is effective until TEX quits the
current group (such as the LATEX environment) or is overridden by another definition (which is,
in most cases, for the rest of the document). To reset your definition, write
\let\betweenLilyPondSystem\undefined
in your LATEX source.
This may be simplified by defining a TEX macro
\def\onlyFirstNSystems#1{
\def\betweenLilyPondSystem##1{%
\ifnum##1<#1\else\expandafter\endinput\fi}
}
and then saying only how many systems you want before each fragment,
\onlyFirstNSystems{3}
\begin{lilypond}...\end{lilypond}
\onlyFirstNSystems{1}
\begin{lilypond}...\end{lilypond}
Chapter 3: Running lilypond-book 30
See also
There are specific lilypond-book command line options and other details to know when
processing LATEX documents, see Section 3.4 [Invoking lilypond-book], page 35.
3.2.2 Texinfo
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.
lilypond-book provides the following commands and environments to include music into
Texinfo files:
• the @lilypond{...} command, where you can directly enter short lilypond code
• the @lilypond...@end lilypond environment, where you can directly enter longer lilypond
code
• the @lilypondfile{...} command to insert a lilypond file
• the @musicxmlfile{...} command to insert a MusicXML file, which will be processed by
musicxml2ly and lilypond.
In the input file, music is specified with any of the following commands
@lilypond[options,go,here]
YOUR LILYPOND CODE
@end lilypond
@lilypondfile[options,go,here]{filename}
@musicxmlfile[options,go,here]{filename}
Additionally, @lilypondversion displays the current version of lilypond.
When lilypond-book is run on it, this results in a Texinfo file (with extension .texi)
containing @image tags for HTML, Info and printed output. lilypond-book generates images
of the music in EPS and PDF formats for use in the printed output, and in PNG format for use
in HTML and Info output.
We show two simple examples here. A lilypond environment
@lilypond[fragment]
c' d' e' f' g'2 g'
@end lilypond
produces
º o o o o \ \
The short version
@lilypond[fragment,staffsize=11]{<c' e' g'>}
produces
º oo
o
Contrary to LATEX, @lilypond{...} does not generate an in-line image. It always gets a
paragraph of its own.
Chapter 3: Running lilypond-book 31
3.2.3 HTML
lilypond-book provides the following commands and environments to include music in HTML
files:
• the <lilypond ... /> command, where you can directly enter short lilypond code
• the <lilyond>...</lilypond> environment, where you can directly enter longer lilypond
code
• the <lilypondfile>...</lilypondfile> command to insert a lilypond file
• the <musicxmlfile>...</musicxmlfile> command to insert a MusicXML file, which will
be processed by musicxml2ly and lilypond.
In the input file, music is specified with any of the following commands:
<lilypond options go here>
YOUR LILYPOND CODE
</lilypond>
º o o \
For inline pictures, use <lilypond ... />, where the options are separated by a colon from
the music, for example
Some music in <lilypond relative=2: a b c/> a line of text.
To include separate files, say
<lilypondfile option1 option2 ...>filename</lilypondfile>
<musicxmlfile> uses the same syntax as <lilypondfile>, but simply references a Mu-
sicXML file rather than a LilyPond file.
For a list of options to use with the lilypond or lilypondfile tags, see Section 3.3 [Music
fragment options], page 32.
Additionally, <lilypondversion/> displays the current version of lilypond.
3.2.4 DocBook
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 standard DocBook elements.
Chapter 3: Running lilypond-book 32
Common conventions
For inserting all type of snippets we use the mediaobject and inlinemediaobject element, so
our snippets can be formatted inline or not inline. The snippet formatting options are always
provided in the role property of the innermost element (see in next sections). Tags are chosen
to allow DocBook editors format the content gracefully. The DocBook files to be processed with
lilypond-book should have the extension .lyxml.
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. Single-line snippets will always be typeset by default as
ragged-right, unless noragged-right is explicitly given.
noragged-right
For single-line snippets, allow the staff length to be stretched to equal that of the
line width, i.e., ragged-right = ##f 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.
papersize=string
Where string is a paper size defined in scm/paper.scm i.e. a5, quarto, 11x17 etc.
Values not defined in scm/paper.scm will be ignored, a warning will be posted and
the snippet will be printed using the default a4 size.
notime Do not print the time signature, and turns off the timing (time 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
Do not 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.4 in and put the output into a quotation
block. The value ‘0.4 in’ 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. relative option only works when fragment option is set, so
fragment is automatically implied by relative, regardless of the presence of any
(no)fragment option in the source.
Chapter 3: Running lilypond-book 34
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.
If verbatim is used in a lilypondfile command, it is possible to enclose verbatim
only a part of the source file. If the source file contain a comment containing ‘begin
verbatim’ (without quotes), quoting the source in the verbatim block will start
after the last occurrence of such a comment; similarly, quoting the source verbatim
will stop just before the first occurrence of a comment containing ‘end verbatim’,
if there is any. In the following source file example, the music will be interpreted in
relative mode, but the verbatim quote will not show the relative block, i.e.
\relative { % begin verbatim
c'4 e2 g4
f2 e % end verbatim
}
will be printed with a verbatim block like
c4 e2 g4
f2 e
If you would like to translate comments and variable names in verbatim output but
not in the sources, you may set the environment variable LYDOC_LOCALEDIR to a
directory path; the directory should contain a tree of .mo message catalogs with
lilypond-doc as a domain.
addversion
(Only for Texinfo output.) Prepend line \version @w{"@version{}"} to verbatim
output.
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 (but outside the example environment generated by a quote option).
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 --pdf --process="lilypond \
-dbackend=eps --header=texidoc" test.texinfo
Most LilyPond test documents (in the input directory of the distribution) are small
.ly files which look exactly like this.
For localization purpose, if the Texinfo document contains @documentlanguage
LANG and foo.ly header contains a texidocLANG field, and if lilypond is called
with --header=texidocLANG, then foo.texidocLANG will be included instead of
foo.texidoc.
Chapter 3: Running lilypond-book 35
doctitle (Only for Texinfo output.) This option works similarly to texidoc option: if
lilypond is called with the --header=doctitle option, and the file to be pro-
cessed is called foo.ly and contains a doctitle field in the \header, it creates a
file foo.doctitle. When doctitle option is used, the contents of foo.doctitle,
which should be a single line of text, is inserted in the Texinfo document as
@lydoctitle text. @lydoctitle should be a macro defined in the Texinfo doc-
ument. The same remark about texidoc processing with localized languages also
applies to doctitle.
nogettext
(Only for Texinfo output.) Do not translate comments and variable names in the
snippet quoted verbatim.
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. Only the base name of
the file is printed, i.e. the directory part of the file path is stripped.
Format-specific instructions
LATEX
There are two ways of processing your LATEX document for printing or publishing: getting a PDF
file directly with PDFLATEX, or getting a PostScript file with LATEX via a DVI to PostScript
translator like dvips. The first way is simpler and recommended1 , and whichever way you use,
you can easily convert between PostScript and PDF with tools, like ps2pdf and pdf2ps included
in Ghostscript package.
To produce a PDF file through PDFLATEX, use:
lilypond-book --pdf yourfile.lytex
pdflatex yourfile.tex
To produce PDF output via LATEX/dvips/ps2pdf:
lilypond-book yourfile.lytex
latex yourfile.tex
dvips -Ppdf yourfile.dvi
ps2pdf yourfile.ps
The .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 .ps and .pdf files.
Running dvips may produce some warnings about fonts; these are harmless and may be
ignored. If you are running latex in twocolumn mode, remember to add -t landscape to the
dvips options.
Environments such as;
\begin{lilypond} ... \end{lilypond}
are not interpreted by LATEX. Instead, lilypond-book extracts those ‘environments’ into files of
its own and runs LilyPond on them. It then takes the resulting graphics and creates a .tex file
1
Note that PDFLATEX and LATEX may not be both usable to compile any LATEX document, that is why we
explain the two ways.
Chapter 3: Running lilypond-book 36
where the \begin{lilypond}. . . \end{lilypond} macros are then replaced by ‘graphics inclu-
sion’ commands. It is at this time that LATEX is run (although LATEX will have run previously, it
will have been, effectively, on an ‘empty’ document in order to calculate things like \linewidth).
Texinfo
To produce a Texinfo document (in any output format), follow the normal procedures for Texinfo;
this is, either call texi2pdf or texi2dvi or makeinfo, depending on the output format you want
to create. By default, texi2pdf uses pdftex for processing, which you can verify in the console
output. In this case, run lilypond-book with the --pdf option so that it creates .pdf snippets
instead of .eps files. pdftex is unable to include the latter ones and will output an error message
otherwise.
See the documentation of Texinfo for further details.
-o dir
--output=dir
Place generated files in directory dir. Running lilypond-book generates lots of
small files that LilyPond will process. To avoid all that garbage in the source
directory, use the --output command line option, and change to that directory
before running latex or makeinfo.
lilypond-book --output=out yourfile.lytex
cd out
...
--skip-lily-check
Do not fail if no lilypond output is found. It is used for LilyPond Info documentation
without images.
--skip-png-check
Do not fail if no PNG images are found for EPS files. It is used for LilyPond Info
documentation without images.
--lily-output-dir=dir
Write lily-XXX files to directory dir, link into --output directory. Use this option
to save building time for documents in different directories which share a lot of
identical snippets.
--lily-loglevel=loglevel
Set the output verbosity of the invoked lilypond calls to loglevel. Possible values
are NONE, ERROR, WARNING, BASIC_PROGRESS, PROGRESS, INFO (default) and DEBUG.
If this option is not used, and the environment variable LILYPOND_LOGLEVEL is set,
its value is used as the loglevel.
--info-images-dir=dir
Format Texinfo output so that Info will look for images of music in dir.
--latex-program=prog
Run executable prog instead of latex. This is useful if your document is processed
with xelatex, for example.
--left-padding=amount
Pad EPS boxes by this much. 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.
The width of a tightly clipped system can vary, due to notation 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.
-P command
--process=command
Process LilyPond snippets using command. The default command is lilypond.
lilypond-book will not --filter and --process at the same time.
--pdf Create PDF files for use with PDFLATEX.
--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.
--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 lilypondfile and only if directories implied
by --output-dir and --lily-output-dir options are different.
Chapter 3: Running lilypond-book 38
-V
--verbose
Be verbose. This is equivalent to --loglevel=DEBUG.
-v
--version
Print version information.
3.6.1 LaTeX
You can include LilyPond fragments in a LaTeX document.
\documentclass[]{article}
\begin{document}
\begin{lilypond}
\relative {
a'4 b c d
Chapter 3: Running lilypond-book 39
}
\end{lilypond}
\begin{lilypond}[fragment,relative=2,quote,staffsize=26,verbatim]
d4 c b a
\end{lilypond}
\end{document}
3.6.2 Texinfo
You can include LilyPond fragments in Texinfo; in fact, this entire manual is written in Texinfo.
\input texinfo
@ifnottex
@node Top
@top
@end ifnottex
Texinfo text
@lilypond
\relative {
a4 b c d
}
@end lilypond
@lilypond[verbatim,fragment,ragged-right]
d4 c b a
@end lilypond
@bye
3.6.3 html
<!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 {
a'4 b c d
}
</lilypond>
</p>
<p>
Chapter 3: Running lilypond-book 40
</body>
</html>
3.6.4 xelatex
\documentclass{article}
\usepackage{ifxetex}
\ifxetex
%xetex specific stuff
\usepackage{xunicode,fontspec,xltxtra}
\setmainfont[Numbers=OldStyle]{Times New Roman}
\setsansfont{Arial}
\else
%This can be empty if you are not going to use pdftex
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathptmx}%Times
\usepackage{helvet}%Helvetica
\fi
%Here you can insert all packages that pdftex also understands
\usepackage[ngerman,finnish,english]{babel}
\usepackage{graphicx}
\begin{document}
\title{A short document with LilyPond and xelatex}
\maketitle
In normal text you can easily use LilyPond commands, like this:
\begin{lilypond}
{a2 b c'8 c' c' c'}
\end{lilypond}
\noindent
and so on.
Chapter 3: Running lilypond-book 41
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
lilypond-book.
\selectlanguage{ngerman}
Auch Umlaute funktionieren ohne die \LaTeX -Befehle, wie auch alle
anderen
seltsamen Zeichen: __ ______, wenn sie von der Schriftart
unterst__tzt werden.
\end{document}
\paper {
#(define (page-post-process layout pages) (oly:create-toc-file layout pages))
}
% 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
Chapter 3: Running lilypond-book 42
\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
}
4 External programs
LilyPond can interact with other programs in various ways.
Using Xpdf
For Xpdf on UNIX, the following should be present in xpdfrc. On UNIX, this file is found
either in /etc/xpdfrc or as $HOME/.xpdfrc.
urlCommand "lilypond-invoke-editor %s"
If you are using Ubuntu, it is likely that the version of Xpdf installed with your system
crashes on every PDF file: this state has been persisting for several years and is due to li-
brary mismatches. Your best bet is to install a current ‘xpdf’ package and the corresponding
‘libpoppler’ package from Debian instead. Once you have tested that this works, you might
want to use
sudo apt-mark hold xpdf
in order to keep Ubuntu from overwriting it with the next ‘update’ of its crashing package.
Chapter 4: External programs 44
Using GNOME 2
For using GNOME 2 (and PDF viewers integrated with it), the magic invocation for telling the
system about the ‘textedit:’ URI is;
gconftool-2 -t string -s /desktop/gnome/url-handlers/textedit/command "lilypond-invoke-editor %s"
gconftool-2 -s /desktop/gnome/url-handlers/textedit/needs_terminal false -t bool
gconftool-2 -t bool -s /desktop/gnome/url-handlers/textedit/enabled true
After that invocation;
gnome-open textedit:///etc/issue:1:0:0
should call lilypond-invoke-editor for opening files.
Using GNOME 3
In GNOME 3, URIs are handled by the ‘gvfs’ layer rather than by ‘gconf’. Create a file in a local
directory such as /tmp that is called lilypond-invoke-editor.desktop and has the contents;
[Desktop Entry]
Version=1.0
Name=lilypond-invoke-editor
GenericName=Textedit URI handler
Comment=URI handler for textedit:
Exec=lilypond-invoke-editor %u
Terminal=false
Type=Application
MimeType=x-scheme-handler/textedit;
Categories=Editor
NoDisplay=true
and then execute the commands
xdg-desktop-menu install ./lilypond-invoke-editor.desktop
xdg-mime default lilypond-invoke-editor.desktop x-scheme-handler/textedit
After that invocation;
gnome-open textedit:///etc/issue:1:0:0
should call lilypond-invoke-editor for opening files.
Selective point-and-click
For some interactive applications, it may be desirable to only include certain point-and-click
items. For example, if somebody wanted to create an application which played audio or video
starting from a particular note, it would be awkward if clicking on the note produced the point-
and-click location for an accidental or slur which occurred over that note.
This may be controlled by indicating which events to include:
• Hard-coded in the .ly file:
\pointAndClickTypes #'note-event
\relative {
c'2\f( f)
}
or
#(ly:set-option 'point-and-click 'note-event)
\relative {
c'2\f( f)
}
• Command-line:
lilypond -dpoint-and-click=note-event example.ly
Multiple events can be included:
• Hard-coded in the .ly file:
\pointAndClickTypes #'(note-event dynamic-event)
\relative {
c'2\f( f)
}
or
#(ly:set-option 'point-and-click '(note-event dynamic-event))
\relative {
c'2\f( f)
}
• Command-line:
lilypond \
-e"(ly:set-option 'point-and-click '(note-event dynamic-event))" \
example.ly
Emacs mode
Emacs has a lilypond-mode, which provides keyword autocompletion, indentation, LilyPond
specific parenthesis matching and syntax coloring, handy compile short-cuts and reading Lily-
Pond manuals using Info. If lilypond-mode is not installed on your platform, see below.
An Emacs mode for entering music and running LilyPond is contained in the source archive
in the elisp directory. Do make install to install it to elispdir. The file lilypond-init.el
should be placed to load-path/site-start.d/ or appended to your ~/.emacs or ~/.emacs.el.
As a user, you may want add your source path (e.g. ~/site-lisp/) to your load-path by
appending the following line (as modified) to your ~/.emacs
(setq load-path (append (list (expand-file-name "~/site-lisp")) load-path))
Vim mode
For Vim (http://www.vim.org), a filetype plugin, indent mode, and syntax-highlighting mode
are available to use with LilyPond. To enable all of these features, create (or modify) your
$HOME/.vimrc to contain these three lines, in order:
filetype off
set runtimepath+=/usr/local/share/lilypond/current/vim/
filetype on
syntax on
If LilyPond is not installed in the /usr/local/ directory, change the path appropriately. This
topic is discussed in Section “Other sources of information” in Learning Manual.
Other editors
Other editors (both text and graphical) support LilyPond, but their special configuration files
are not distributed with LilyPond. Consult their documentation for more information. Such
editors are listed in Section “Easier editing” in General Information.
midi2ly converts tracks into Section “Staff” in Internals Reference and channels into Section
“Voice” in Internals Reference contexts. Relative mode is used for pitches, durations are only
written when necessary.
It is possible to record a MIDI file using a digital keyboard, and then convert it to .ly.
However, human players are not rhythmically exact enough to make a MIDI to LY conversion
trivial. When invoked with quantizing (-s and -d options) midi2ly tries to compensate for these
timing errors, but is not very good at this. It is therefore not recommended to use midi2ly for
human-generated midi files.
It is invoked from the command-line as follows,
midi2ly [option]... midi-file
Note that by ‘command-line’, we mean the command line of the operating system. See
Section 4.3 [Converting from other formats], page 46, for more information about this.
The following options are supported by midi2ly.
-a, --absolute-pitches
Print absolute pitches.
-d, --duration-quant=DUR
Quantize note durations on DUR.
-e, --explicit-durations
Print explicit durations.
-h, --help
Show summary of usage.
-k, --key=acc[:minor]
Set default key. acc > 0 sets number of sharps; acc < 0 sets number of flats. A
minor key is indicated by :1.
-o, --output=file
Write output to file.
-s, --start-quant=DUR
Quantize note starts on DUR.
-t, --allow-tuplet=DUR*NUM/DEN
Allow tuplet durations DUR*NUM /DEN.
-v, --verbose
Be verbose.
-V, --version
Print version number.
-w, --warranty
Show warranty and copyright.
-x, --text-lyrics
Treat every text as a lyric.
-r, --relative
convert pitches in relative mode (default).
--transpose=TOPITCH
the interval between pitch c and TOPITCH to transpose by.
--sm, --shift-meter=BEATS/BEATTYPE
change the length|duration of notes as a function of a given time signature to make
the score look faster or slower, (e.g. 4/4 or 2/2).
--tc, --tab-clef=TABCLEFNAME
switch between two versions of tab clefs (tab and moderntab).
--sn --string-numbers=t[rue]/f[alse]
deactivate string number stencil with --string-numbers false. Default is true.
-v, --verbose
be verbose.
--version
show version number and exit.
-z, --compressed
input file is a zip-compressed MusicXML file.
4.4.1 LuaTex
As well as lilypond-book to integrate LilyPond output, there is an alternative program that
can be used when using LuaTex called lyluatex (https://github.com/jperon/lyluatex/
blob/master/README.md).
recent versions of LibreOffice and OpenOffice. Older versions should work as well. It has even
been tested with OpenOffice 2.4 without issues.
{ f8 c c | }
\new Staff {
f8 f c |
}
>>
r4 |
}
}
is much easier to follow than;
\new Staff { \relative { r4 g'8 g c4 c8 d | e4 r8
% Ossia section
<< { f8 c c } \new Staff { f8 f c } >> r4 | } }
• Keep music and style separate by putting overrides in the \layout block;
\score {
...music...
\layout {
\override TabStaff.Stemstencil = ##f
}
}
This will not create a new context but it will apply when one is created. Also see Section
“Saving typing with variables and functions” in Learning Manual, and Section “Style sheets”
in Learning Manual.
• Use a variable for each voice, with a minimum of structure inside the definition. The
structure of the \score section is the most likely thing to change; the violin definition is
extremely unlikely to change in a new version of LilyPond.
violin = \relative {
g'4 c'8. e16
}
...
\score {
\new GrandStaff {
\new Staff {
\violin
}
}
}
• Separate tweaks from music definitions. This point was made previously, but for large
projects it is absolutely vital. We might need to change the definition of fthenp, but then
we only need to do this once, and we can still avoid touching anything inside violin.
fthenp = _\markup{
\dynamic f \italic \small { 2nd } \hspace #0.1 \dynamic p }
violin = \relative {
g'4\fthenp c'8. e16
}
5.4 Troubleshooting
Sooner or later, you will write a file that LilyPond cannot compile. The messages that LilyPond
gives may help you find the error, but in many cases you need to do some investigation to
determine the source of the problem.
The most powerful tools for this purpose are the single line comment (indicated by %) and the
block comment (indicated by %{...%}). If you don’t know where a problem is, start commenting
out huge portions of your input file. After you comment out a section, try compiling the file
again. If it works, then the problem must exist in the portion you just commented. If it doesn’t
work, then keep on commenting out material until you have something that works.
In an extreme case, you might end up with only
\score {
<<
% \melody
% \harmony
% \bass
>>
\layout{}
}
(in other words, a file without any music)
If that happens, don’t give up. Uncomment a bit – say, the bass part – and see if it works.
If it doesn’t work, then comment out all of the bass music (but leave \bass in the \score
uncommented.
bass = \relative {
%{
c'4 c c c
d d d d
Chapter 5: Suggestions for writing files 55
%}
}
Now start slowly uncommenting more and more of the bass part until you find the problem
line.
Another very useful debugging technique is constructing Section “Tiny examples” in General
Information.
| |-- symphonyI.ly
| |-- symphonyII.ly
| |-- symphonyIII.ly
| `-- symphonyIV.ly
`-- symphonyDefs.ily
The .ly files in the Scores and Parts directories get their notes from .ily files in the Notes
directory:
%%% top of file "symphony-cello.ly"
\include "../symphonyDefs.ily"
\include "../Notes/cello.ily"
The makefile will have targets of score (entire piece in full score), movements (individual
movements in full score), and parts (individual parts for performers). There is also a target
archive that will create a tarball of the source files, suitable for sharing via web or email. Here
is the makefile for GNU/Linux or MacOS X. It should be saved with the name Makefile in the
top directory of the project:
☛ ✟
Note: When a target or pattern rule is defined, the subsequent lines
must begin with tabs, not spaces.
✡ ✠
# the name stem of the output files
piece := symphony
# The command to run lilypond
LILY_CMD := lilypond -ddelete-intermediate-files \
-dno-point-and-click
.DEFAULT_GOAL := score
PDFDIR := PDF
MIDIDIR := MIDI
# The pattern rule to create PDF and MIDI files from a LY input file.
# The .pdf output files are put into the `PDF' subdirectory, and the
# .midi files go into the `MIDI' subdirectory.
%.pdf %.midi: %.ly | $(PDFDIR) $(MIDIDIR)
$(LILY_CMD) $< # this line begins with a tab
mv "$*.pdf" $(PDFDIR)/ # this line begins with a tab
mv "$*.midi" $(MIDIDIR)/ # this line begins with a tab
Chapter 5: Suggestions for writing files 57
$(PDFDIR):
mkdir $(PDFDIR)
$(MIDIDIR):
mkdir $(MIDIDIR)
common := symphonyDefs.ily
notes := \
cello.ily \
horn.ily \
oboe.ily \
viola.ily \
violinOne.ily \
violinTwo.ily
movements: $(piece)I.pdf \
$(piece)II.pdf \
$(piece)III.pdf \
$(piece)IV.pdf
There are special complications on the Windows platform. After downloading and installing
GNU Make for Windows, you must set the correct path in the system’s environment variables
so that the DOS shell can find the Make program. To do this, right-click on "My Computer,"
then choose Properties and Advanced. Click Environment Variables, and then in the System
Variables pane, highlight Path, click edit, and add the path to the GNU Make executable file,
which will look something like this:
C:\Program Files\GnuWin32\bin
The makefile itself has to be altered to handle different shell commands and to deal with
spaces that are present in some default system directories. Windows also has a different default
extension for midi files.
## WINDOWS VERSION
##
piece := symphony
LILY_CMD := lilypond -ddelete-intermediate-files \
-dno-point-and-click
.DEFAULT_GOAL := score
PDFDIR := PDF
MIDIDIR := MIDI
VPATH := \
$(workdir)/Scores \
$(workdir)/Parts \
$(workdir)/Notes \
$(workdir)/$(PDFDIR) \
$(workdir)/$(MIDIDIR)
$(PDFDIR):
mkdir $(PDFDIR)/
$(MIDIDIR):
mkdir $(MIDIDIR)/
Chapter 5: Suggestions for writing files 59
notes := \
cello.ily \
figures.ily \
horn.ily \
oboe.ily \
trioString.ily \
viola.ily \
violinOne.ily \
violinTwo.ily
common := symphonyDefs.ily
.PHONY: score
score: $(piece).pdf
.PHONY: parts
parts: $(piece)-cello.pdf \
$(piece)-violinOne.pdf \
$(piece)-violinTwo.pdf \
$(piece)-viola.pdf \
$(piece)-oboe.pdf \
$(piece)-horn.pdf
.PHONY: movements
movements: $(piece)I.pdf \
$(piece)II.pdf \
$(piece)III.pdf \
$(piece)IV.pdf
WEBDIR=htmlout
VIEWER=acroread
BROWSER=firefox
LILYBOOK_PDF=lilypond-book --output=$(OUTDIR) --pdf $(FILE).lytex
LILYBOOK_HTML=lilypond-book --output=$(WEBDIR) $(FILE).lytex
PDF=cd $(OUTDIR) && pdflatex $(FILE)
HTML=cd $(WEBDIR) && latex2html $(FILE)
INDEX=cd $(OUTDIR) && makeindex $(FILE)
PREVIEW=$(VIEWER) $(OUTDIR)/$(FILE).pdf &
pdf:
$(LILYBOOK_PDF) # begin with tab
$(PDF) # begin with tab
$(INDEX) # begin with tab
$(PDF) # begin with tab
$(PREVIEW) # begin with tab
web:
$(LILYBOOK_HTML) # begin with tab
$(HTML) # begin with tab
cp -R $(WEBDIR)/$(FILE)/ ./ # begin with tab
$(BROWSER) $(FILE)/$(FILE).html & # begin with tab
keep: pdf
cp $(OUTDIR)/$(FILE).pdf $(FILE).pdf # begin with tab
clean:
rm -rf $(OUTDIR) # begin with tab
web-clean:
rm -rf $(WEBDIR) # begin with tab
archive:
tar -cvvf myproject.tar \ # begin this line with tab
--exclude=out/* \
--exclude=htmlout/* \
--exclude=myproject/* \
--exclude=*midi \
--exclude=*pdf \
--exclude=*~ \
../MyProject/*
TODO: make this thing work on Windows
The previous makefile does not work on Windows. An alternative for Windows users would
be to create a simple batch file containing the build commands. This will not keep track of
dependencies the way a makefile does, but it at least reduces the build process to a single
command. Save the following code as build.bat or build.cmd. The batch file can be run at
the DOS prompt or by simply double-clicking its icon.
lilypond-book --output=out --pdf myproject.lytex
cd out
Chapter 5: Suggestions for writing files 61
pdflatex myproject
makeindex myproject
pdflatex myproject
cd ..
copy out\myproject.pdf MyProject.pdf
See also
This manual: Section 1.2 [Command-line usage], page 1, Chapter 3 [lilypond-book], page 24,
62
covers must also clearly and legibly identify you as the publisher of these copies. The front
cover must present the full title with all words of the title equally prominent and visible.
You may add other material on the covers in addition. Copying with changes limited to
the covers, as long as they preserve the title of the Document and satisfy these conditions,
can be treated as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit legibly, you should put the
first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto
adjacent pages.
If you publish or distribute Opaque copies of the Document numbering more than 100, you
must either include a machine-readable Transparent copy along with each Opaque copy,
or state in or with each Opaque copy a computer-network location from which the general
network-using public has access to download using public-standard network protocols a
complete Transparent copy of the Document, free of added material. If you use the latter
option, you must take reasonably prudent steps, when you begin distribution of Opaque
copies in quantity, to ensure that this Transparent copy will remain thus accessible at the
stated location until at least one year after the last time you distribute an Opaque copy
(directly or through your agents or retailers) of that edition to the public.
It is requested, but not required, that you contact the authors of the Document well before
redistributing any large number of copies, to give them a chance to provide you with an
updated version of the Document.
4. MODIFICATIONS
You may copy and distribute a Modified Version of the Document under the conditions
of sections 2 and 3 above, provided that you release the Modified Version under precisely
this License, with the Modified Version filling the role of the Document, thus licensing
distribution and modification of the Modified Version to whoever possesses a copy of it. In
addition, you must do these things in the Modified Version:
A. Use in the Title Page (and on the covers, if any) a title distinct from that of the
Document, and from those of previous versions (which should, if there were any, be
listed in the History section of the Document). You may use the same title as a previous
version if the original publisher of that version gives permission.
B. List on the Title Page, as authors, one or more persons or entities responsible for
authorship of the modifications in the Modified Version, together with at least five of
the principal authors of the Document (all of its principal authors, if it has fewer than
five), unless they release you from this requirement.
C. State on the Title page the name of the publisher of the Modified Version, as the
publisher.
D. Preserve all the copyright notices of the Document.
E. Add an appropriate copyright notice for your modifications adjacent to the other copy-
right notices.
F. Include, immediately after the copyright notices, a license notice giving the public
permission to use the Modified Version under the terms of this License, in the form
shown in the Addendum below.
G. Preserve in that license notice the full lists of Invariant Sections and required Cover
Texts given in the Document’s license notice.
H. Include an unaltered copy of this License.
I. Preserve the section Entitled “History”, Preserve its Title, and add to it an item stating
at least the title, year, new authors, and publisher of the Modified Version as given
on the Title Page. If there is no section Entitled “History” in the Document, create
one stating the title, year, authors, and publisher of the Document as given on its
Appendix A: GNU Free Documentation License 65
Title Page, then add an item describing the Modified Version as stated in the previous
sentence.
J. Preserve the network location, if any, given in the Document for public access to a
Transparent copy of the Document, and likewise the network locations given in the
Document for previous versions it was based on. These may be placed in the “History”
section. You may omit a network location for a work that was published at least four
years before the Document itself, or if the original publisher of the version it refers to
gives permission.
K. For any section Entitled “Acknowledgements” or “Dedications”, Preserve the Title
of the section, and preserve in the section all the substance and tone of each of the
contributor acknowledgements and/or dedications given therein.
L. Preserve all the Invariant Sections of the Document, unaltered in their text and in their
titles. Section numbers or the equivalent are not considered part of the section titles.
M. Delete any section Entitled “Endorsements”. Such a section may not be included in
the Modified Version.
N. Do not retitle any existing section to be Entitled “Endorsements” or to conflict in title
with any Invariant Section.
O. Preserve any Warranty Disclaimers.
If the Modified Version includes new front-matter sections or appendices that qualify as
Secondary Sections and contain no material copied from the Document, you may at your
option designate some or all of these sections as invariant. To do this, add their titles to
the list of Invariant Sections in the Modified Version’s license notice. These titles must be
distinct from any other section titles.
You may add a section Entitled “Endorsements”, provided it contains nothing but endorse-
ments of your Modified Version by various parties—for example, statements of peer review
or that the text has been approved by an organization as the authoritative definition of a
standard.
You may add a passage of up to five words as a Front-Cover Text, and a passage of up
to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified
Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added
by (or through arrangements made by) any one entity. If the Document already includes
a cover text for the same cover, previously added by you or by arrangement made by the
same entity you are acting on behalf of, you may not add another; but you may replace the
old one, on explicit permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License give permission to
use their names for publicity for or to assert or imply endorsement of any Modified Version.
5. COMBINING DOCUMENTS
You may combine the Document with other documents released under this License, under
the terms defined in section 4 above for modified versions, provided that you include in the
combination all of the Invariant Sections of all of the original documents, unmodified, and
list them all as Invariant Sections of your combined work in its license notice, and that you
preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and multiple identical
Invariant Sections may be replaced with a single copy. If there are multiple Invariant
Sections with the same name but different contents, make the title of each such section
unique by adding at the end of it, in parentheses, the name of the original author or
publisher of that section if known, or else a unique number. Make the same adjustment to
the section titles in the list of Invariant Sections in the license notice of the combined work.
Appendix A: GNU Free Documentation License 66
In the combination, you must combine any sections Entitled “History” in the various original
documents, forming one section Entitled “History”; likewise combine any sections Entitled
“Acknowledgements”, and any sections Entitled “Dedications”. You must delete all sections
Entitled “Endorsements.”
6. COLLECTIONS OF DOCUMENTS
You may make a collection consisting of the Document and other documents released under
this License, and replace the individual copies of this License in the various documents with
a single copy that is included in the collection, provided that you follow the rules of this
License for verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute it individually
under this License, provided you insert a copy of this License into the extracted document,
and follow this License in all other respects regarding verbatim copying of that document.
7. AGGREGATION WITH INDEPENDENT WORKS
A compilation of the Document or its derivatives with other separate and independent
documents or works, in or on a volume of a storage or distribution medium, is called an
“aggregate” if the copyright resulting from the compilation is not used to limit the legal
rights of the compilation’s users beyond what the individual works permit. When the
Document is included in an aggregate, this License does not apply to the other works in
the aggregate which are not themselves derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these copies of the Document,
then if the Document is less than one half of the entire aggregate, the Document’s Cover
Texts may be placed on covers that bracket the Document within the aggregate, or the
electronic equivalent of covers if the Document is in electronic form. Otherwise they must
appear on printed covers that bracket the whole aggregate.
8. TRANSLATION
Translation is considered a kind of modification, so you may distribute translations of the
Document under the terms of section 4. Replacing Invariant Sections with translations
requires special permission from their copyright holders, but you may include translations
of some or all Invariant Sections in addition to the original versions of these Invariant
Sections. You may include a translation of this License, and all the license notices in
the Document, and any Warranty Disclaimers, provided that you also include the original
English version of this License and the original versions of those notices and disclaimers. In
case of a disagreement between the translation and the original version of this License or a
notice or disclaimer, the original version will prevail.
If a section in the Document is Entitled “Acknowledgements”, “Dedications”, or “History”,
the requirement (section 4) to Preserve its Title (section 1) will typically require changing
the actual title.
9. TERMINATION
You may not copy, modify, sublicense, or distribute the Document except as expressly pro-
vided under this License. Any attempt otherwise to copy, modify, sublicense, or distribute
it is void, and will automatically terminate your rights under this License.
However, if you cease all violation of this License, then your license from a particular copy-
right holder is reinstated (a) provisionally, unless and until the copyright holder explicitly
and finally terminates your license, and (b) permanently, if the copyright holder fails to
notify you of the violation by some reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is reinstated permanently if the
copyright holder notifies you of the violation by some reasonable means, this is the first
time you have received notice of violation of this License (for any work) from that copyright
holder, and you cure the violation prior to 30 days after your receipt of the notice.
Appendix A: GNU Free Documentation License 67
Termination of your rights under this section does not terminate the licenses of parties
who have received copies or rights from you under this License. If your rights have been
terminated and not permanently reinstated, receipt of a copy of some or all of the same
material does not give you any rights to use it.
10. FUTURE REVISIONS OF THIS LICENSE
The Free Software Foundation may publish new, revised versions of the GNU Free Doc-
umentation License from time to time. Such new versions will be similar in spirit to the
present version, but may differ in detail to address new problems or concerns. See https://
www.gnu.org/copyleft/.
Each version of the License is given a distinguishing version number. If the Document
specifies that a particular numbered version of this License “or any later version” applies
to it, you have the option of following the terms and conditions either of that specified
version or of any later version that has been published (not as a draft) by the Free Software
Foundation. If the Document does not specify a version number of this License, you may
choose any version ever published (not as a draft) by the Free Software Foundation. If the
Document specifies that a proxy can decide which future versions of this License can be
used, that proxy’s public statement of acceptance of a version permanently authorizes you
to choose that version for the Document.
11. RELICENSING
“Massive Multiauthor Collaboration Site” (or “MMC Site”) means any World Wide Web
server that publishes copyrightable works and also provides prominent facilities for anybody
to edit those works. A public wiki that anybody can edit is an example of such a server. A
“Massive Multiauthor Collaboration” (or “MMC”) contained in the site means any set of
copyrightable works thus published on the MMC site.
“CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0 license published
by Creative Commons Corporation, a not-for-profit corporation with a principal place of
business in San Francisco, California, as well as future copyleft versions of that license
published by that same organization.
“Incorporate” means to publish or republish a Document, in whole or in part, as part of
another Document.
An MMC is “eligible for relicensing” if it is licensed under this License, and if all works that
were first published under this License somewhere other than this MMC, and subsequently
incorporated in whole or in part into the MMC, (1) had no cover texts or invariant sections,
and (2) were thus incorporated prior to November 1, 2008.
The operator of an MMC Site may republish an MMC contained in the site under CC-BY-
SA on the same site at any time before August 1, 2009, provided the MMC is eligible for
relicensing.
Appendix A: GNU Free Documentation License 68
A H
ABC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 \header in LATEX documents . . . . . . . . . . . . . . . . . . . . . . 29
Aborted (core dumped) . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Articulate project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 HTML, adding music . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
HTML, embeddable SVG scores . . . . . . . . . . . . . . . . . . . 5
B
Bar and bar number checks . . . . . . . . . . . . . . . . . . . 16, 52 I
Bar lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
invoking dvips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Invoking lilypond . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
C
call trace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
chroot jail, running inside . . . . . . . . . . . . . . . . . . . . . . . . . . 3 L
Coda Technology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Collision resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 LANG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
coloring, syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 LaTex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
command line options for lilypond . . . . . . . . . . . . . . . . 2 LaTeX, adding music . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
convert-ly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 LibreOffice.org . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
LILYPOND DATADIR . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
LILYPOND LOCALEDIR. . . . . . . . . . . . . . . . . . . . . . . . 11
D LILYPOND LOGLEVEL . . . . . . . . . . . . . . . . . . . . . . . . . 11
directory, redirect output . . . . . . . . . . . . . . . . . . . . . . . . . . 4 LILYPOND RELOCDIR . . . . . . . . . . . . . . . . . . . . . . . . . 11
docbook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 loglevel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
DocBook, adding music . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 LuaTex. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
documents, adding music . . . . . . . . . . . . . . . . . . . . . . . . . 24 lyluatex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
dvips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
M
E
MacOS X . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1, 24, 46
Easier editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46, 50 make . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
editors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
makefiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Manuals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Enhancing MIDI output . . . . . . . . . . . . . . . . . . . . . . . . . . 51
MIDI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46, 51
enigma . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
modes, editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Enigma Transport Format . . . . . . . . . . . . . . . . . . . . . . . . 50
music fragments, quoting . . . . . . . . . . . . . . . . . . . . . . . . . 51
error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
error messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 musicology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
errors, message format . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 MusicXML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
ETF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Evince . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Explicitly instantiating voices . . . . . . . . . . . . . . . . . . . . . 18 O
expression evaluation, Scheme . . . . . . . . . . . . . . . . . . . . . 2 Octave checks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
External programs, generating LilyPond files . . . . . . 50 OOoLilyPond . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Extracting fragments of music . . . . . . . . . . . . . . . . . . 6, 51 OpenOffice.org . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
options, command line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Other sources of information . . . . . . . . . . . . . . . . . . . . . . 46
F outline fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
fatal error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 output, directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
file searching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 output, format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
file size, output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 output, PDF (Portable Document Format) . . . . . . . . . 5
Finale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 output, PNG (Portable Network Graphics) . . . . . . . . . 5
Flexible vertical spacing within systems . . . . . . . . . . . 17 output, PS (PostScript). . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
format, output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 output, setting filename. . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
fragments, music . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 output, SVG (Scalable Vector Graphics) . . . . . . . . . . . 5
output, verbosity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
G
Grand Unified Builder (GUB) . . . . . . . . . . . . . . . . . . . . 12
Appendix B: LilyPond index 70
P T
PDF (Portable Document Format), output . . . . . . . . . 5 texi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
PNG (Portable Network Graphics), output . . . . . . . . . 5 texinfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
point and click . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 Texinfo, adding music . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
point and click, command line . . . . . . . . . . . . . . . . . . . . . 5 Text encoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
PostScript (PS), output. . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 thumbnail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
preview image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Tiny examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Programming error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 titling and lilypond-book . . . . . . . . . . . . . . . . . . . . . . . . . 29
PS (PostScript), output. . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 titling in HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
pspdfopt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 trace, Scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
type1 fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Q
quoting, music fragments . . . . . . . . . . . . . . . . . . . . . . . . . 51
U
Updating a LilyPond file . . . . . . . . . . . . . . . . . . . . . . . . . 19
R updating old input files . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Real music example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
relocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
V
vim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
S Voice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Saving typing with variables and functions . . . . . . . . 53
Scheme error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Scheme, expression evaluation . . . . . . . . . . . . . . . . . . . . . 2
W
search path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 warning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Single-staff polyphony . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 web pages, SVG scores embeddable . . . . . . . . . . . . . . . . 5
Skipping corrected music . . . . . . . . . . . . . . . . . . . . . . . . . 53 Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Staff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Working with input files . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Style sheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
SVG (Scalable Vector Graphics), output . . . . . . . . . . . 5
switches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 X
syntax coloring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Xpdf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43