1 @c -*- coding: latin-1; mode: texinfo; -*-
3 @chapter Running LilyPond
5 This chapter details the technicalities of running LilyPond.
15 @node Invoking lilypond
16 @section Invoking lilypond
17 @cindex Invoking LilyPond
18 @cindex command line options
19 @cindex options, command line
23 The @code{lilypond} executable may be called as follows from the command line.
26 lilypond [@var{option}]@dots{} @var{file}@dots{}
30 When invoked with a filename that has no extension, the @file{.ly}
31 extension is tried first. To read input from stdin, use a
32 dash (@code{-}) for @var{file}.
34 When @file{filename.ly} is processed it will produce
35 @file{filename.tex} as output (or @file{filename.ps} for PostScript
36 output). If @file{filename.ly} contains more than one @code{\score}
37 block, then the rest of the scores will be output in numbered files,
38 starting with @file{filename-1.tex}. Several files can be specified;
39 they will each be processed independently. @footnote{The status of
40 GUILE is not reset after processing a @code{.ly} file, so be careful
41 not to change any system defaults from within Scheme.}
44 @section Command line options
46 The following options are supported:
50 @item -e,--evaluate=@var{expr}
51 Evaluate the Scheme @var{expr} before parsing any @file{.ly} files.
52 Multiple @code{-e} options may be given, they will be evaluated
53 sequentially. The function @code{ly:set-option} allows access to
54 some internal variables. Use @code{-e '(ly:option-usage)'} for more
57 @item -f,--format=@var{format}
58 which formats should be written. Choices are @code{svg}, @code{ps},
59 @code{pdf}, @code{png}, @code{tex}, @code{dvi}.
61 @item -b,--backend=@var{format}
62 the output format to use for the back-end. Choices are
65 for @TeX{} output, to be processed with La@TeX{}. If present, the file
66 @file{file.textmetrics} is read to determine text extents.
68 dump text strings to @file{.texstr} file, which can be run through
69 (La)@TeX{}, resulting in a @code{.textmetrics} file, which contains the
70 extents of strings of text.
73 @cindex PostScript output
75 Postscript files include TTF, Type1 and OTF fonts. No subsetting of
76 these fonts is done. When using oriental character sets, this can
80 for encapsulated PostScript. This dumps every page (system) as a separate
81 @file{EPS} file, without fonts, and as one collated @file{EPS} file with
82 all pages (systems) including fonts.
84 This mode is used by default by lilypond-book.
87 for SVG (Scalable Vector Graphics)
88 @cindex SVG (Scalable Vector Graphics)
90 for a dump of the raw, internal Scheme-based drawing commands.
94 @cindex output format, setting
97 Show a summary of usage.
99 @item --include, -I=@var{directory}
100 Add @var{directory} to the search path for input files.
101 @cindex file searching
104 @item -i,--init=@var{file}
105 Set init file to @var{file} (default: @file{init.ly}).
107 @item -o,--output=@var{FILE}
108 Set the default output file to @var{FILE}. The appropriate
109 suffix will be added (ie @code{.pdf} for pdf, @code{.tex}
116 Generate DVI files. In this case, the @TeX{} backend should be
117 specified, i.e., @code{-f tex}.
120 Generate pictures of each page, in PNG format. This implies @code{--ps}.
123 Generate PDF. This implies @code{--ps}.
126 Generate an output file containing the titles and the first system
129 Do not generate the full pages. Useful in combination with
133 Do not trust the @code{.ly} input.
135 When LilyPond formatting is available through a web server, the
136 @code{--safe} @b{MUST} be passed. This will prevent inline Scheme
137 code from wreaking havoc, for example
143 c4^#(ly:export (ly:gulp-file "/etc/passwd"))
148 The @code{--safe} option works by evaluating in-line Scheme
149 expressions in a special safe module. This safe module is derived from
150 GUILE @file{safe-r5rs} module, but adds a number of functions of the
151 LilyPond API. These functions are listed in @file{scm/@/safe@/-lily@/.scm}.
153 In addition, @code{--safe} disallows @code{\include} directives and
154 disables the use of backslashes in @TeX{} strings.
156 In @code{--safe} mode, it is not possible to import LilyPond variables
159 @code{--safe} does @emph{not} detect resource overuse. It is still
160 possible to make the program hang indefinitely, for example by feeding
161 cyclic data structures into the backend. Therefore, if using LilyPond
162 on a publicly accessible webserver, the process should be limited in
163 both CPU and memory usage.
166 Show version information.
169 Be verbose: show full paths of all files read, and give timing
173 Show the warranty with which GNU LilyPond comes. (It comes with
174 @strong{NO WARRANTY}!)
178 @section Environment variables
180 For processing both the @TeX{} and the PostScript output, the
181 appropriate environment variables must be set. The following scripts
185 @item @file{buildscripts/@/out/@/lilypond@/-profile}
187 @item @file{buildscripts/@/out/@/lilypond@/-login} (for C-shells)
190 They should normally be sourced as part of the login process. If these
191 scripts are not run from the system wide login process, then you must
194 @cindex installing LilyPond
196 If you use sh, bash, or a similar shell, then add the following to
197 your @file{.profile}:
199 . @var{/the/path/to/}lilypond-profile
202 If you use csh, tcsh or a similar shell, then add the following to
203 your @file{~/.login}:
205 source @var{/the/path/to/}lilypond-login
208 Of course, in both cases, you should substitute the proper location of
211 These scripts set the following variables:
214 To make sure that @TeX{} and lilypond find data files (among
215 others @file{.tex}, @file{.mf}, and @file{.tfm}),
216 you have to set @code{TEXMF} to point to the lilypond data
217 file tree. A typical setting would be
219 @{/usr/share/lilypond/2.4.0,@{!!/usr/share/texmf@}@}
227 @cindex printing postscript
229 The binary itself recognizes the following environment variables:
232 This specifies a directory where locale messages and
233 data files will be looked up by default. The directory should contain
234 subdirectories called @file{ly/}, @file{ps/}, @file{tex/}, etc.
237 This selects the language for the warning messages.
241 @cindex LILYPONDPREFIX
244 @section Error messages
246 @cindex error messages
247 Different error messages can appear while compiling a file:
253 Something looks suspect. If you are requesting something out of the
254 ordinary then you will understand the message, and can ignore it.
255 However, warnings usually indicate that something is wrong with the
259 Something is definitely wrong. The current processing step (parsing,
260 interpreting, or formatting) will be finished, but the next step will
266 Something is definitely wrong, and LilyPond cannot continue. This
267 happens rarely. The most usual cause is misinstalled fonts.
269 @cindex trace, Scheme
273 Errors that occur while executing Scheme code are caught by the Scheme
274 interpreter. If running with the verbose option (@code{-V} or
275 @code{--verbose}) then a call trace of the offending
276 function call is printed.
278 @cindex Programming error
279 @item Programming error
280 There was some internal inconsistency. These error messages are
281 intended to help the programmers and debuggers. Usually, they can be
282 ignored. Sometimes, they come in such big quantities that they obscure
283 other output. In this case, file a bug-report.
285 @item Aborted (core dumped)
286 This signals a serious programming error that caused the program to
287 crash. Such errors are considered critical. If you stumble on one,
293 @cindex errors, message format
294 If warnings and errors can
295 be linked to some part of the input file, then error messages have the
299 @var{filename}:@var{lineno}:@var{columnno}: @var{message}
300 @var{offending input line}
303 A line-break is inserted in the offending line to indicate the column
304 where the error was found. For example,
307 test.ly:2:19: error: not a duration: 5:
312 These locations are LilyPond's best guess about where the warning or
313 error occured, but (by their very nature) warnings and errors occur
314 when something unexpected happens. If you can't see an error in the
315 indicated line of your input file, try checking one or two lines
316 above the indicated position.
320 @section Reporting bugs
323 @cindex reporting bugs
325 If you have input that results in a crash or an erroneous output, then
326 that is a bug. We try to respond to bug-reports promptly, and fix them as
327 soon as possible. Help us by sending a defective input file, so we can
328 reproduce the problem. Make it small, so we can easily debug the
329 problem. Don't forget to tell which version of LilyPond you use! Send
330 the report to @email{bug-lilypond@@gnu.org}.
332 When you've found a bug, have a look at our
333 @uref{http://@/lilypond@/.org/@/doc/@/v2.3/@/bugs/,bug database} to see if
334 it has already been reported. You could also try to do a few searches
335 on the mailing list for the bug. Sometimes the bug will have already
336 been reported and a fix or workaround is already known.
338 Here is an example of a good bug report:
341 It seems that placement of accidentals is broken. In the
342 following example, the accidental touches the note head.
344 Using Mac OSX 10.3.5, fink package lilypond-unstable
355 \override Accidental #'extra-offset = #'(1.0 . 0)
361 @section Editor support
366 @cindex modes, editor
367 @cindex syntax coloring
368 @cindex coloring, syntax
370 There is support from different editors for LilyPond.
374 Emacs has a @file{lilypond-mode}, which provides keyword
375 autocompletion, indentation, LilyPond specific parenthesis matching
376 and syntax coloring, handy compile short-cuts and reading LilyPond
377 manuals using Info. If @file{lilypond-mode} is not installed on your
378 platform, then read the
380 @uref{../../../topdocs/out-www/INSTALL.html,installation instructions}.
383 installation instructions.
388 For @uref{http://@/www@/.vim@/.org,VIM}, a @file{vimrc} is supplied, along
389 with syntax coloring tools. For more information, refer to the
391 @uref{../../../topdocs/out-www/INSTALL.html,installation instructions}.
394 installation instructions.
400 The @uref{http://@/www@/.jedit@/.org/,jEdit} editor has a LilyPond plugin.
401 This plugin includes a DVI viewer, integrated help and viewing via
402 GhostScript. It can be installed by doing @key{Plugins > Plugin
403 Manager}, and selecting @code{LilyTool} from the @key{Install} tab.
407 All these editors can be made to jump into the input file to the source
408 of a symbol in the graphical output. See @ref{Point and click}.