]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/invoking.itely
Lots of small changes.
[lilypond.git] / Documentation / user / invoking.itely
1 @c -*- coding: latin-1; mode: texinfo; -*-
2 @node Running LilyPond
3 @chapter Running LilyPond
4
5 This chapter details the technicalities of running LilyPond.
6
7
8 @menu
9 * Invoking lilypond::
10 * Error messages::
11 * Reporting bugs::
12 * Editor support::
13 @end menu
14
15 @node Invoking lilypond
16 @section Invoking lilypond
17 @cindex Invoking LilyPond
18 @cindex command line options
19 @cindex options, command line
20 @cindex switches
21
22
23 The @code{lilypond} executable may be called as follows from the command line.
24
25 @example
26 lilypond [@var{option}]@dots{} @var{file}@dots{}
27 @end example
28
29
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}.
33
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.}
42
43
44 @section Command line options
45
46 The following options are supported:
47
48 @table @code
49
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
55 information.
56
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}.
60
61 @item -b,--backend=@var{format}
62 the output format to use for the back-end.  Choices are
63 @table @code
64 @item tex
65 for @TeX{} output, to be processed with La@TeX{}.  If present, the file
66 @file{file.textmetrics} is read to determine text extents.
67 @item texstr
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.
71 @item ps
72  for PostScript.
73 @cindex PostScript output
74
75   Postscript files include TTF, Type1 and OTF fonts.  No subsetting of
76   these fonts is done.  When using oriental character sets, this can
77   lead to huge files.  
78   
79 @item eps
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.
83
84 This mode  is used by default by lilypond-book.
85
86 @item svg
87  for SVG (Scalable Vector Graphics)
88 @cindex SVG (Scalable Vector Graphics)
89 @item scm
90  for a dump of the raw, internal Scheme-based drawing commands.
91 @cindex Scheme dump
92 @end table
93  
94 @cindex output format, setting
95
96 @item -h,--help
97 Show a summary of usage.
98
99 @item --include, -I=@var{directory}
100 Add @var{directory} to the search path for input files.
101 @cindex file searching
102 @cindex search path
103
104 @item -i,--init=@var{file}
105 Set init file to @var{file} (default: @file{init.ly}).
106
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}
110 for tex, etc).
111
112 @item --ps
113 Generate PostScript.
114
115 @item --dvi
116 Generate DVI files.  In this case, the @TeX{} backend should be
117 specified, i.e., @code{-f tex}.
118
119 @item --png
120 Generate pictures of each page, in PNG format.  This implies @code{--ps}.
121
122 @item --pdf
123 Generate PDF.  This implies @code{--ps}.
124
125 @item --preview
126 Generate an output file containing the titles and the first system
127
128 @item --no-pages
129 Do not generate the full pages.  Useful in combination with
130 @code{--preview}.
131
132 @item -s,--safe
133 Do not trust the @code{.ly} input.
134
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
138
139 @quotation
140 @verbatim
141 #(system "rm -rf /")
142 {
143   c4^#(ly:export (ly:gulp-file "/etc/passwd"))
144 }
145 @end verbatim
146 @end quotation
147
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}.
152
153 In addition, @code{--safe} disallows @code{\include} directives and
154 disables the use of backslashes in @TeX{} strings.
155
156 In @code{--safe} mode, it is not possible to import LilyPond variables
157 into Scheme.
158
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.
164
165 @item -v,--version
166 Show version information.
167
168 @item -V,--verbose
169 Be verbose: show full paths of all files read, and give timing
170 information.
171
172 @item -w,--warranty
173 Show the warranty with which GNU LilyPond comes. (It comes with
174 @strong{NO WARRANTY}!)
175 @end table
176
177
178 @section Environment variables
179
180 For processing both the @TeX{} and the PostScript output, the
181 appropriate environment variables must be set.  The following scripts
182 do this:
183
184 @itemize @bullet
185 @item @file{buildscripts/@/out/@/lilypond@/-profile}
186 (for SH shells)
187 @item @file{buildscripts/@/out/@/lilypond@/-login} (for C-shells)
188 @end itemize
189
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
192 run them yourself.
193
194 @cindex installing LilyPond
195
196 If you use sh, bash, or a similar shell, then add the following to
197 your @file{.profile}:
198 @example
199 . @var{/the/path/to/}lilypond-profile
200 @end example
201
202 If you use csh, tcsh or a similar shell, then add the following to
203 your @file{~/.login}:
204 @example
205 source @var{/the/path/to/}lilypond-login
206 @end example
207
208 Of course, in both cases, you should substitute the proper location of
209 either script.
210
211 These scripts set the following variables:
212 @table @code
213 @item TEXMF
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
218 @example
219 @{/usr/share/lilypond/2.4.0,@{!!/usr/share/texmf@}@}
220 @end example
221
222 @end table
223
224
225 @cindex PostScript
226 @cindex TEXMF
227 @cindex printing postscript
228
229 The binary itself recognizes the following environment variables:
230 @table @code
231 @item LILYPONDPREFIX
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.
235
236 @item LANG
237 This selects the language for the warning messages.
238 @end table
239
240 @cindex LANG
241 @cindex LILYPONDPREFIX
242
243 @node Error messages
244 @section Error messages
245
246 @cindex error messages
247 Different error messages can appear while compiling a file:
248
249 @table @emph
250 @cindex warning
251
252 @item Warning
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
256 input file.
257
258 @item Error
259 Something is definitely wrong.  The current processing step (parsing,
260 interpreting, or formatting) will be finished, but the next step will
261 be skipped.
262
263 @cindex error
264 @cindex fatal error
265 @item Fatal error
266 Something is definitely wrong, and LilyPond cannot continue.  This
267 happens rarely.  The most usual cause is misinstalled fonts.
268
269 @cindex trace, Scheme
270 @cindex call trace
271 @cindex Scheme error
272 @item Scheme error
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.
277
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.
284
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,
288 send a bug-report.
289
290
291 @end table
292
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
296 following form
297
298 @example
299 @var{filename}:@var{lineno}:@var{columnno}: @var{message}
300 @var{offending input line}
301 @end example
302
303 A line-break is inserted in the offending line to indicate the column
304 where the error was found.  For example,
305
306 @example
307 test.ly:2:19: error: not a duration: 5:
308   @{ c'4 e'5
309              g' @}
310 @end example
311
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.
317
318
319 @node Reporting bugs
320 @section Reporting bugs
321
322 @cindex bugs
323 @cindex reporting bugs
324
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}.
331
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.
337
338 Here is an example of a good bug report:
339
340 @example
341 It seems that placement of accidentals is broken.  In the
342 following example, the accidental touches the note head.
343
344 Using Mac OSX 10.3.5, fink package lilypond-unstable
345
346 \version "2.3.22"
347 \relative c''@{
348    a4 b cis d
349 @}
350 @end example
351
352 @lilypond[quote]
353 \version "2.3.22"
354 \relative c''{
355   \override Accidental #'extra-offset = #'(1.0 . 0)
356   a4 b cis d
357 }
358 @end lilypond
359
360 @node Editor support
361 @section Editor support
362
363 @cindex editors
364 @cindex vim
365 @cindex emacs
366 @cindex modes, editor
367 @cindex syntax coloring
368 @cindex coloring, syntax
369
370 There is support from different editors for LilyPond.
371
372 @table @asis
373 @item Emacs
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
379 @ifhtml
380 @uref{../../../topdocs/out-www/INSTALL.html,installation instructions}.
381 @end ifhtml
382 @ifnothtml
383 installation instructions.
384 @end ifnothtml
385
386 @item VIM
387
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
390 @ifhtml
391 @uref{../../../topdocs/out-www/INSTALL.html,installation instructions}.
392 @end ifhtml
393 @ifnothtml
394 installation instructions.
395 @end ifnothtml
396
397
398 @item JEdit
399
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.
404
405 @end table
406
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}.
409
410