1 @c -*- coding: latin-1; mode: texinfo; -*-
3 @chapter Running LilyPond
5 This chapter details the technicalities of running LilyPond.
13 * Invoking lilypond-latex::
16 @node Invoking lilypond
17 @section Invoking lilypond
18 @cindex Invoking LilyPond
19 @cindex command line options
20 @cindex options, command line
24 The @code{lilypond} may be called as follows from the command line.
27 lilypond [@var{option}]@dots{} @var{file}@dots{}
31 When invoked with a filename that has no extension, the @file{.ly}
32 extension is tried first. To read input from stdin, use a
33 dash @code{-} for @var{file}.
35 When @file{filename.ly} is processed it will produce
36 @file{filename.tex} as output (or @file{filename.ps} for PostScript
37 output). If @file{filename.ly} contains more than one @code{\score}
38 block, then the rest of the scores will be output in numbered files,
39 starting with @file{filename-1.tex}. Several files can be specified;
40 they will each be processed independently. @footnote{The status of
41 GUILE is not reset after processing a @code{.ly} files, so be careful
42 not to change any system defaults from within Scheme.}
45 @section Command line options
47 The following options are supported:
51 @item -e,--evaluate=@var{expr}
52 Evaluate the Scheme @var{expr} before parsing any @file{.ly} files.
53 Multiple @code{-e} options may be given, they will be evaluated
54 sequentially. The function @code{ly:set-option} allows for access to
55 some internal variables. Use @code{-e '(ly:option-usage)'} for more
58 @item -f,--format=@var{format}
61 A comma separated list of back-end output formats to use. Choices are
62 @code{tex} (for @TeX{} output, to be processed with La@TeX{}, and
63 @code{ps} for PostScript.
65 There are other output options, but they are intended for developers.
68 @cindex output format, setting
69 @cindex PostScript output
73 Show a summary of usage.
74 @item --include, -I=@var{directory}
75 Add @var{directory} to the search path for input files.
76 @cindex file searching
78 @item -i,--init=@var{file}
79 Set init file to @var{file} (default: @file{init.ly}).
80 @item -o,--output=@var{FILE}
81 Set the default output file to @var{FILE}.
85 Generate DVI files. In this case, the @TeX{} backend should be
86 specified, i.e. @code{-f tex}.
88 Generate pictures of each page, in PNG format. This implies @code{--ps}.
90 Generate PDF. This implies @code{--ps}.
92 Generate an output file containing the titles and the first system
96 Do not trust the @code{.ly} input.
98 When LilyPond formatting is available through a web server, the
99 @code{--safe} @b{MUST} be passed. This will prevent inline Scheme
100 code from wreaking havoc, for example
105 c4^#(ly:export (ly:gulp-file "/etc/passwd"))
109 The @code{--safe} option works by evaluating in-line Scheme
110 expressions in a special safe module. This safe module is derived from
111 GUILE @file{safe-r5rs} module, but adds a number of functions of the
112 LilyPond API. These functions are listed in @file{scm/safe-lily.scm}.
114 In addition, @code{--safe} disallows @code{\include} directives and
115 disables the use of backslashes in @TeX{} strings.
117 In @code{--safe} mode, it is not possible to import LilyPond variables
121 Show version information.
123 Be verbose: show full paths of all files read, and give timing
127 Show the warranty with which GNU LilyPond comes. (It comes with
128 @strong{NO WARRANTY}!)
131 @section Environment variables
134 For processing both the @TeX{} and the PostScript output, the
135 appropriate environment variables must be set. The following scripts
139 @item @file{buildscripts/out/lilypond-profile}
141 @item @file{buildscripts/out/lilypond-login} (for C-shells)
144 They should normally be sourced as part of the login process. If these
145 scripts are not run from the system wide login process, then you must
148 @cindex installing LilyPond
150 If you use sh, bash, or a similar shell, then add the following to
151 your @file{.profile}:
153 . @var{/the/path/to/}lilypond-profile
156 If you use csh, tcsh or a similar shell, then add the following to
157 your @file{~/.login}:
159 source @var{/the/path/to/}lilypond-login
162 Of course, in both cases, you should substitute the proper location of
165 These scripts set the following variables:
168 To make sure that @TeX{} and lilypond find data files (among
169 others @file{.tex}, @file{.mf} and @file{.tfm}),
170 you have to set @code{TEXMF} to point to the lilypond data
171 file tree. A typical setting would be
173 @{/usr/share/lilypond/1.6.0,@{!!/usr/share/texmf@}@}
181 @cindex printing postscript
183 The binary itself recognizes the following environment variables:
186 This specifies a directory where locale messages and
187 data files will be looked up by default. The directory should contain
188 subdirectories called @file{ly/}, @file{ps/}, @file{tex/}, etc.
191 This selects the language for the warning messages.
195 @cindex LILYPONDPREFIX
198 @section Error messages
200 @cindex error messages
201 Different error messages can appear while compiling a file:
207 Something looks suspect. If you are requesting something out of the
208 ordinary then you will understand the message, and can ignore it.
209 However, warnings usually indicate that something is wrong with the
213 Something is definitely wrong. The current processing step (parsing,
214 interpreting, or formatting) will be finished, but the next step will
220 Something is definitely wrong, and LilyPond cannot continue. This
221 happens rarely. The most usual cause is misinstalled fonts.
223 @cindex trace, Scheme
227 Errors that occur while executing Scheme code are caught by the Scheme
228 interpreter. If running with the verbose option (@code{-V} or
229 @code{--verbose}) then a call trace is printed of the offending
232 @cindex Programming error
233 @item Programming error
234 There was some internal inconsistency. These error messages are
235 intended to help the programmers and debuggers. Usually, they can be
236 ignored. Sometimes, they come in such big quantities that they obscure
237 other output. In this case, file a bug-report.
239 @item Aborted (core dumped)
240 This signals a serious programming error that caused the program to
241 crash. Such errors are considered critical. If you stumble on one,
247 @cindex errors, message format
248 If warnings and errors can
249 be linked to some part of the input file, then error messages have the
253 @var{filename}:@var{lineno}:@var{columnno}: @var{message}
254 @var{offending input line}
257 A line-break is inserted in offending line to indicate the column
258 where the error was found. For example,
261 test.ly:2:19: error: not a duration: 5:
266 These locations are LilyPond's best guess about where the warning or
267 error occured, but (by their very nature) warning and errors occur
268 when something unexpected happens. If you can't see an error in the
269 indicated line of your input file, try checking one or two lines
270 above the indicated position.
274 @section Reporting bugs
277 @cindex reporting bugs
279 If you have input that results in a crash or an erroneous output, then
280 that is a bug. We try respond to bug-reports promptly, and fix them as
281 soon as possible. Help us by sending a defective input file, so we can
282 reproduce the problem. Make it small, so we can easily debug the
283 problem. Don't forget to tell which version of LilyPond you use! Send
284 the report to @email{bug-lilypond@@gnu.org}.
286 When you've found a bug, have a look at our
287 @uref{http://lilypond.org/doc/v2.3/bugs/,bug database} to see if it
288 has already been reported. You could also try doing a few searches
289 on the mailing list for the bug. Sometimes the bug will have already
290 been reported and a fix or workaround is already known.
292 Here is an example of a good bug report:
296 It seems that placement of accidentals is broken. In the
297 following example, the accidental touches the note head.
299 Using Mac OSX 10.3.5, fink package lilypond-unstable
310 \override Accidental #'extra-offset = #'(1.0 . 0)
316 @section Editor support
321 @cindex modes, editor
322 @cindex syntax coloring
323 @cindex coloring, syntax
325 There is support from different editors for LilyPond.
329 Emacs has a @file{lilypond-mode}, which provides keyword
330 autocompletion, indentation, LilyPond specific parenthesis matching
331 and syntax coloring, handy compile short-cuts and reading LilyPond
332 manuals using Info. If @file{lilypond-mode} is not installed on your
333 platform, then read the
335 @uref{../../../topdocs/out-www/INSTALL.html,installation instructions}.
338 installation instructions.
343 For @uref{http://www.vim.org,VIM}, a @file{vimrc} is supplied, along with
344 syntax coloring tools. For more information, refer to the
346 @uref{../../../topdocs/out-www/INSTALL.html,installation instructions}.
349 installation instructions.
355 The @uref{http://www.jedit.org/,jEdit} editor has a LilyPond plugin.
356 This plugin includes a DVI viewer, integrated help and viewing via
357 GhostScript. It can be installed by doing @key{Plugins > Plugin
358 Manager}, and selecting @code{LilyTool} from the @key{Install} tab.
362 All these editors can be made to jump in the input file to the source
363 of a symbol in the graphical output. See @ref{Point and click}.
368 @node Invoking lilypond-latex
369 @section Invoking lilypond-latex
371 Before LilyPond 3.0, the @code{lilypond} program only generated music
372 notation. Titles and page layout was done in a separate wrapper
373 program. For compatibility with older files, this wrapper program has
374 been retained as @code{lilypond-latex}. It uses the LilyPond program
375 and La@TeX{} to create a nicely titled piece of sheet music. Use of
376 this program is only necessary if the input file contains special
377 La@TeX{} options or formatting codes in markup texts.
379 The @code{lilypond-latex} wrapper is invoked from the command-line as
382 @code{lilypond-latex} [@var{option}]@dots{} @var{file}@dots{}
385 To have @code{lilypond-latex} read from stdin, use a dash @code{-} for
386 @var{file}. The program supports the following options.
388 @cindex stdin, reading
392 Keep the temporary directory with all output
393 files. The temporary directory is created in the current directory as @code{@code{lilypond}.dir}.
396 @item -I,--include=@var{dir}
397 Add @var{dir} to LilyPond's include path.
398 @item -o,--output=@var{file}
399 Generate output to @var{file}. The extension of @var{file} is ignored.
401 Also generate pictures of each page, in PNG format.
403 Also generate a picture of the first system of the score.
412 @item -s,--set=@var{key}=@var{val}
413 Add @var{key}= @var{val} to the settings, overriding those specified
414 in the files. Possible keys: @code{language}, @code{latexheaders},
415 @code{latexpackages}, @code{latexoptions}, @code{papersize},
416 @code{linewidth}, @code{orientation},
419 Show version information.
421 Be verbose. This prints out commands as they are executed, and more
422 information about the formatting process is printed.
424 Print even more information. This is useful when generating bug reports.
426 Show the warranty with which GNU LilyPond comes. (It comes with
427 @strong{NO WARRANTY}!)
432 @subsection Additional parameters
434 The @code{lilypond} program responds to several parameters specified
435 in a @code{\layout} section of the input file. They can be overridden
436 by supplying a @code{--set} command line option.
440 Specify La@TeX{} language: the @code{babel} package will be
441 included. Default: unset.
443 Read from the @code{\header} block.
446 Specify additional La@TeX{} headers file.
447 Normally read from the @code{\header} block. Default value: empty.
450 Specify additional La@TeX{} packages file. This works cumulative,
451 so you can add multiple packages using multiple @code{-s=latexpackages} options.
452 Normally read from the @code{\header} block. Default value:
456 Specify additional options for the La@TeX{}
457 @code{\documentclass}. You can put any valid value here. This was
458 designed to allow @code{lilypond} to produce output for double-sided
459 paper, with balanced margins and page numbers on alternating sides. To
460 achieve this specify @code{twoside}.
463 Set orientation. Choices are @code{portrait} or @code{landscape}. Is
464 read from the @code{\layout} block, if set.
467 The vertical extension of the music on the page. It is normally
468 calculated automatically, based on the paper size.
471 The music line width. It is normally read from the @code{\layout}
475 The paper size (as a name, e.g. @code{a4}). It is normally read from
476 the @code{\layout} block.
479 The font encoding, should be set identical to the @code{font-encoding}
480 property in the score.