]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/invoking.itexi
proofreaded (HJJ).
[lilypond.git] / Documentation / user / invoking.itexi
1 @c -*-texinfo-*-
2 @node Invoking LilyPond
3 @chapter Invoking LilyPond
4
5 This chapter details the technicalities of running LilyPond.
6
7  
8 @menu
9 * Invoking the lilypond binary::  
10 * Reporting bugs::              
11 * Point and click::             
12 * Invoking ly2dvi::             Titling LilyPond scores.
13 @end menu
14
15
16
17 @node Invoking the lilypond binary
18 @section Invoking the lilypond binary
19 @cindex Invoking LilyPond
20 @cindex command line options
21 @cindex options, command line
22 @cindex switches
23
24
25 The LilyPond system consists of two parts: a binary executable, which
26 is responsible for the formatting functionality, and support scripts,
27 which post-process the resulting output. Normally, the support scripts
28 are called, which in turn invoke the @code{lilypond} binary. However,
29 @code{lilypond} may be called directly as follows.
30
31 @example
32         lilypond [@var{option}]@dots{} @var{file}@dots{}
33 @end example
34
35
36 When invoked with a filename that has no extension, the @file{.ly}
37 extension is tried first.  To read input from  stdin, use a
38 dash @code{-} for @var{file}.
39
40 When @file{filename.ly} is processed it will produce
41 @file{filename.tex} as output (or @file{filename.ps} for PostScript
42 output).  If @file{filename.ly} contains more than one @code{\score}
43 block, then the rest of the scores will be output in numbered files,
44 starting with @file{filename-1.tex}.  Several files can be specified;
45 they will each be processed independently.  @footnote{The status of
46   GUILE is not reset across invocations, so be careful not to change any
47   default settings from within Scheme.}
48
49
50 @section Command line options
51
52 The following options are supported:
53
54 @table @code
55
56 @item -e,--evaluate=@var{expr}
57 Evaluate the Scheme @var{expr} before parsing any @file{.ly} files.
58 Multiple @code{-e} options may be given, they will be evaluated
59 sequentially.  The function @code{ly:set-option} allows for access to
60 some internal variables.  Use @code{-e '(ly:option-usage')} for more
61 information.
62
63 @item -f,--format=@var{format}
64 @c
65 @c
66 Output format for sheet music. Choices are @code{tex} (for @TeX{}
67 output, to be processed with plain @TeX{}, or through ly2dvi),
68 @code{pdftex} for PDF@TeX{} input, @code{ps} (for PostScript),
69 @code{scm} (for a Scheme dump), @code{sk} (for Sketch) and @code{as}
70 (for ASCII-art).
71
72 @strong{This option is only for developers}. Only the @TeX{} output of
73 these is usable for real work.
74
75
76 @cindex output format, setting
77 @cindex Sketch output
78 @cindex ASCII-art output
79 @cindex PDFTeX output
80 @cindex PostScript output
81 @cindex Scheme dump
82
83 @item -h,--help
84 Show a summary of usage.
85 @item --include, -I=@var{directory}
86 Add @var{directory} to the search path for input files.
87 @cindex file searching
88 @cindex search path
89 @item -i,--init=@var{file}
90 Set init file to @var{file} (default: @file{init.ly}).
91 @item -m,--no-paper
92 @cindex MIDI
93 Disable @TeX{} output. If you have a @code{\midi} definition MIDI output
94 will be generated.
95 @item -M,--dependencies
96 Output rules to be included in Makefile.
97 @item -o,--output=@var{FILE}
98 Set the default output file to @var{FILE}.
99
100 @ignore
101 @item -s,--safe
102 Disallow untrusted @code{\include} directives, in-line
103 Scheme evaluation, backslashes in @TeX{}, code.
104
105 @strong{WARNING}: the @code{--safe} option has not been reviewed for a
106 long time. Do not rely on it for automatic invocation (e.g. over the
107 web). Volunteers are welcome to do a new audit.
108 @end ignore
109
110 @item -v,--version
111 Show version information.
112 @item -V,--verbose
113 Be verbose: show full paths of all  files read, and give timing
114 information.
115
116 @item -w,--warranty
117 Show the warranty with which GNU LilyPond comes. (It comes with 
118 @strong{NO WARRANTY}!)
119 @end table
120
121 @section Environment variables
122
123
124 For processing both the @TeX{} and the PostScript output, the
125 appropriate environment variables must be set.  The following scripts
126 do this:
127
128 @itemize @bullet
129 @item @file{buildscripts/out/lilypond-profile}
130 (for SH shells)
131 @item  @file{buildscripts/out/lilypond-login} (for C-shells)
132 @end itemize
133
134 They should normally be sourced as part of the login process. If these
135 scripts are not run from the system wide login process, then you must
136 run it yourself.
137
138 @cindex installing LilyPond
139
140 If you use sh, bash, or a similar shell, then add the following to
141 your @file{.profile}:
142 @example
143         . @var{/the/path/to/}lilypond-profile
144 @end example
145
146 If you use csh, tcsh or a similar shell, then add the following to
147 your @file{~/.login}:
148 @example
149         source @var{/the/path/to/}lilypond-login
150 @end example
151
152 Of course, in both cases, you should substitute the proper location of
153 either script.
154
155 These scripts set the following variables:
156 @table @code
157 @item TEXMF
158  To make sure that @TeX{} and lilypond find data files (among
159 others @file{.tex}, @file{.mf} and @file{.tfm}),
160 you have to set @code{TEXMF} to point to the lilypond data
161 file tree. A typical setting would be
162 @example
163 @{/usr/share/lilypond/1.6.0,@{!!/usr/share/texmf@}@}
164 @end example
165
166
167 @item GS_LIB
168 For processing PostScript output (obtained with
169 @code{-f ps}) with Ghostscript you have to set @code{GS_LIB} to
170 point to the directory containing library PS files.
171
172 @item GS_FONTPATH
173 For processing PostScript output (obtained with
174 @code{-f ps}) with Ghostscript you have to set @code{GS_FONTPATH} to
175 point to the directory containing  PFA files.
176
177 When you print direct PS output, remember to send the PFA files to the
178 printer as well.
179 @end table
180
181
182 @cindex ghostscript
183 @cindex PostScript
184 @cindex GS_FONTPATH
185 @cindex GS_LIB
186 @cindex TEXMF
187 @cindex printing postscript
188
189 The  binary itself recognizes the following environment variables:
190 @table @code
191 @item LILYPONDPREFIX
192 This specifies a directory where locale messages and
193 data files will be looked up by default. The directory should contain
194 subdirectories called @file{ly/}, @file{ps/}, @file{tex/}, etc.
195
196 @item LANG
197 This selects the language for the warning messages.
198 @end table
199
200 @cindex LANG
201 @cindex LILYPONDPREFIX
202
203
204
205
206 @node Reporting bugs
207 @section Reporting bugs
208
209 @cindex bugs
210 @cindex reporting bugs
211
212 If you have input that results in a crash or an erroneous output, then
213 that is a bug. We try respond to bug-reports promptly, and fix them as
214 soon as possible. For this, we need to replicate and isolate the
215 problem. Please help us by sending a good bug-report: an input file
216 that will reproduce the problem. Please make it small, so we can
217 easily isolate the problem. Don't forget to tell which version you
218 use, and on which platform you run it.  Send the report to
219 @email{bug-lilypond@@gnu.org}.
220
221 @node Point and click
222 @section Point and click
223 @cindex poind and click
224
225 Point and click lets you find notes in the input by clicking on them in
226 the Xdvi window. This makes it easier to find input that causes some
227 error in the sheet music.
228
229 To use it, you need the following software:
230 @itemize @bullet
231 @item a dvi viewer that supports src specials:
232 @itemize @bullet
233 @item Xdvi, version 22.36 or newer.  Available from
234 @uref{ftp://ftp.math.berkeley.edu/pub/Software/TeX/xdvi.tar.gz,ftp.math.berkeley.edu}.
235
236    Most @TeX{} distributions ship with xdvik, which is always
237   a few versions behind the official Xdvi. To find out which Xdvi you
238   are running, try @code{xdvi -version} or @code{xdvi.bin -version}.
239 @item KDVI.  A dvi viewer for KDE.  You need KDVI from KDE 3.0 or
240 newer.  Enable option @emph{Inverse search} in the menu @emph{Settings}.
241
242 Apparently, KDVI does not process PostScript specials correctly. Beams
243 and slurs will not be visible in KDVI.
244
245 @cindex Xdvi
246 @cindex KDVI
247 @cindex KDE
248
249
250
251 @end itemize
252 @item an editor with a client/server interface (or a lightweight GUI
253 editor):
254
255 @cindex editor
256
257 @itemize @bullet
258 @item Emacs. Emacs is an extensible text-editor.  It is available from
259 @uref{http://www.gnu.org/software/emacs/}.  You need version 21 to use
260 column location.
261
262 @c move this elsewhere?
263
264 There is also support for Emacs: lilypond-mode for Emacs provides
265 keyword autocompletion, indentation, LilyPond specific parenthesis
266 matching and syntax coloring, handy compile short-cuts and reading
267 LilyPond manuals using Info.  If lilypond-mode is not installed on
268 your platform, then refer to the installation instructions for more
269 information.
270
271 @cindex Emacs
272 @cindex Emacs mode
273 @cindex lilypond-mode for Emacs
274 @cindex syntax coloring
275
276 @item XEmacs. XEmacs is very similar to Emacs.
277
278 @cindex XEmacs
279
280 @item NEdit.  NEdit runs under Windows, and Unix.
281   It is available from @uref{http://www.nedit.org}.
282
283 @cindex NEdit
284
285 @item GVim.  GVim is a GUI variant of VIM, the popular VI
286 clone.  It is available from @uref{http://www.vim.org}.
287
288 @cindex GVim
289 @cindex Vim
290
291 @end itemize
292 @end itemize
293
294
295 Xdvi must be configured to find the @TeX{} fonts and music
296 fonts. Refer to the Xdvi documentation for more information.
297
298 To use point-and-click, add one of these lines to the top of your .ly
299 file:
300 @example
301 #(ly:set-point-and-click 'line)
302 @end example
303 @cindex line-location
304
305 When viewing, Control-Mousebutton 1 will take you to the originating
306 spot in the @file{.ly} file.  Control-Mousebutton 2 will show all
307 clickable boxes.
308
309 If you correct large files with point-and-click, be sure to start
310 correcting at the end of the file. When you start at the top, and
311 insert one line, all following locations will be off by a line.
312
313 @cindex Emacs
314 For using point-and-click with Emacs,  add the following
315 In your Emacs startup file (usually @file{~/.emacs}):
316 @example
317 (server-start)
318 @end example
319
320 Make sure that the environment variable @var{XEDITOR} is set to
321 @example
322 emacsclient --no-wait +%l %f
323 @end example
324 @cindex @var{XEDITOR}
325 If you use XEmacs instead of Emacs, you use @code{(gnuserve-start)} in
326 your @file{.emacs}, and set @code{XEDITOR} to @code{gnuclient -q +%l %f}.
327
328 For using Vim, set @code{XEDITOR} to @code{gvim --remote +%l %f}, or
329 use this argument with Xdvi's @code{-editor} option.
330
331 @cindex NEdit
332 For using NEdit, set @code{XEDITOR} to @code{nc -noask +%l %f}, or
333 use this argument with Xdvi's @code{-editor} option.
334
335 If can also make your editor jump to the exact location of the note
336 you clicked. This is only supported on Emacs and VIM. Users of Emacs version
337 20 must apply the patch @file{emacsclient.patch}. Users of version 21
338 must apply @file{server.el.patch} (version 21.2 and earlier).  At the
339 top of the @code{ly} file, replace the @code{set-point-and-click} line
340 with the following line:
341 @example
342 #(ly:set-point-and-click 'line-column)
343 @end example
344 @cindex line-colomn-location
345 and set @code{XEDITOR} to @code{emacsclient --no-wait +%l:%c %f}.  Vim
346 users can set @var{XEDITOR} to @code{gvim --remote +:%l:norm%c| %f}.
347
348
349
350 @refbugs
351
352 When you convert the @TeX{} file to PostScript using @code{dvips}, it
353 will complain about not finding @code{src:X:Y} files. These complaints
354 are harmless, and can be ignored.
355
356
357
358 @node Invoking ly2dvi
359 @section Invoking ly2dvi
360
361 Nicely titled output is created through a separate program:
362 @file{ly2dvi} is a script that uses LilyPond and La@TeX{} to create a
363 nicely titled piece of sheet music, in DVI format or PostScript:
364
365 @example
366         ly2dvi [@var{option}]@dots{} @var{file}@dots{}
367 @end example
368
369 To have ly2dvi read from stdin, use a dash @code{-} for @var{file}.
370
371 Ly2dvi supports the following options:
372
373 @table @code
374 @item -k,--keep
375     Keep the temporary directory including LilyPond and ly2dvi output
376 files. The temporary directory is created in the current directory as @code{ly2dvi.dir}.
377 @item -d,--dependencies
378     Write @code{Makefile} dependencies for every input file.
379 @item -h,--help
380     Print usage help.
381 @item -I,--include=@var{dir}
382     Add @var{dir} to LilyPond's include path.
383 @item -m,--no-paper
384     Produce MIDI output only.
385 @item --no-lily
386     Do not run LilyPond; useful for debugging ly2dvi.
387 @item -o,--output=@var{file}
388     Generate output to @var{file}.  The extension of @var{file} is ignored.
389 @item -P,--postscript
390     Also generate PostScript output, using dvips.  The postscript uses
391 the standard @TeX{} bitmap fonts for your printer.
392 @item -p,--pdf
393     Also generate Portable Document Format (PDF).  This option will
394 generate a PS file using scalable fonts, and will run the PS file
395 through @code{ps2pdf} producing a PDF file.
396
397 @cindex PDF
398 @cindex Scalable fonts
399     
400     If you use lilypond-book or your own wrapper files, do not use
401 @code{\usepackage[[T1]@{fontenc@}} in the file header but do not forget
402 @code{\usepackage[latin1]@{inputenc@}} if you use any other
403 non-anglosaxian characters.
404
405 @item --png
406     Also generate pictures of each page, in PNG format. 
407 @item --psgz
408     Gzip the postscript file.
409 @item --html
410     Make a .HTML file with links to all output files.
411 @item --preview
412     Also generate a picture of the first system of the score.
413
414 @cindex preview
415 @cindex picture
416 @cindex bitmap
417 @cindex pixmap
418 @cindex thumbnail
419 @cindex screenshot
420     
421 @item -s,--set=@var{key}=@var{val}
422     Add @var{key}= @var{val} to the settings, overriding those specified
423 in the files. Possible keys: @code{language}, @code{latexheaders},
424 @code{latexpackages}, @code{latexoptions}, @code{papersize},
425 @code{pagenumber}, @code{linewidth}, @code{orientation},
426 @code{textheight}.
427 @item -v,--version
428 Show version information.
429 @item -V,--verbose
430 Be verbose.
431 @item --debug
432 Print even more information. This is useful when generating bugreports.
433 @item -w,--warranty
434 Show the warranty with which GNU LilyPond comes. (It comes with 
435 @strong{NO WARRANTY}!)
436 @end table
437
438 @subsection Titling layout
439
440 Ly2dvi extracts the following header fields from the LY files to
441 generate titling; an example demonstrating all these fields is in
442 @inputfileref{input/test,ly2dvi-testpage.ly}:
443
444 @table @code
445 @item title
446     The title of the music. Centered on top of the first page.
447 @item subtitle
448     Subtitle, centered below the title.
449 @item poet
450     Name of the poet, left flushed below the subtitle.
451 @item composer
452     Name of the composer, right flushed below the subtitle.
453 @item meter
454     Meter string, left flushed below the poet.
455 @item opus
456     Name of the opus, right flushed below the composer.
457 @item arranger
458     Name of the arranger, right flushed below the opus.
459 @item instrument
460     Name of the instrument, centered below the arranger.
461 @item dedication            
462     To whom the piece is dedicated.
463 @item piece
464     Name of the piece, left flushed below the instrument.
465 @item head
466     A text to print in the header of all pages. It is not called
467 @code{header}, because @code{\header} is a reserved word in LilyPond.
468 @item copyright
469     A text to print in the footer of the first page. Default is to 
470     print the standard footer also on the first page.
471 @item footer
472     A text to print in the footer of all but the last page.
473 @item tagline
474     Line to print at the bottom of last page. The default text is ``Lily
475 was here, @var{version-number}''.
476 @end table
477
478
479 @cindex header
480 @cindex footer
481 @cindex page layout
482 @cindex titles
483
484
485
486 @subsection Additional parameters
487
488 Ly2dvi responds to several parameters specified in a @code{\paper}
489 section of the input file. They can be overridden by supplying a
490 @code{--set} command line option.
491
492 @table @code
493 @item language
494     Specify La@TeX{} language: the @code{babel} package will be
495 included.  Default: unset.
496
497         Read from the @code{\header} block.
498
499 @item latexheaders
500     Specify additional La@TeX{} headers file.
501
502         Normally read from the @code{\header} block. Default value: empty.
503
504 @item latexpackages
505     Specify additional La@TeX{} packages file. This works cumulative,
506 so you can add multiple packages using multiple @code{-s=latexpackages} options.
507        Normally read from the @code{\header} block. Default value:
508 @code{geometry}.
509
510 @item latexoptions
511     Specify additional options for the La@TeX{}
512 @code{\documentclass}. You can put any valid value here. This was
513 designed to allow ly2dvi to produce output for double-sided paper,
514 with balanced margins and pagenumbers on alternating sides. To achieve
515 this specify @code{twoside}.
516
517 @item orientation
518     Set orientation. Choices are @code{portrait} or @code{landscape}. Is
519 read from the @code{\paper} block, if set.
520         
521 @item textheight
522     The vertical extension of the music on the page. It is normally 
523     calculated automatically, based on the paper size.
524
525 @item linewidth
526         The music line width. It is normally read from the @code{\paper}
527 block.
528
529 @item papersize
530    The paper size (as a name, e.g. @code{a4}). It is normally read from
531 the @code{\paper} block.
532
533 @item pagenumber
534    If set to @code{no}, no page numbers will be printed.  If set to a
535 positive integer, start with this value as the first page number.
536
537   
538   @item fontenc
539      The font encoding, should be set identical to the @code{font-encoding}
540      property in the score.
541 @end table
542
543