* scripts/lilypond-book.py (option_definitions): typo
[lilypond.git] / Documentation / user / invoking.itexi
blobfeaa644aafe3b72b40480284344c6560448d2b09
1 @c -*-texinfo-*-
2 @node Invoking LilyPond
3 @chapter Invoking LilyPond
5 This chapter details the technicalities of running LilyPond.
7  
8 @menu
9 * Invoking the lilypond binary::  
10 * Reporting bugs::              
11 * Point and click::             
12 * Invoking ly2dvi::             Titling LilyPond scores.
13 @end menu
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
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.
31 @example
32         lilypond [@var{option}]@dots{} @var{file}@dots{}
33 @end example
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}.
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.}
50 @section Command line options
52 The following options are supported:
54 @table @code
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.
63 @item -f,--format=@var{format}
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).
72 @strong{This option is only for developers}. Only the @TeX{} output of
73 these is usable for real work.
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
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}.
100 @ignore
101 @item -s,--safe
102 Disallow untrusted @code{\include} directives, in-line
103 Scheme evaluation, backslashes in @TeX{}, code.
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
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.
116 @item -w,--warranty
117 Show the warranty with which GNU LilyPond comes. (It comes with 
118 @strong{NO WARRANTY}!)
119 @end table
121 @section Environment variables
124 For processing both the @TeX{} and the PostScript output, the
125 appropriate environment variables must be set.  The following scripts
126 do this:
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
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.
138 @cindex installing LilyPond
140 If you use sh, bash, or a similar shell, then add the following to
141 your @file{.profile}
142 @example
143         . lilypond-profile
144 @end example
146 If you use csh, tcsh or a similar shell, then add the following to
147 your @file{~/.login}
148 @example
149         source lilypond-login
150 @end example
152 These scripts set the following variables
153 @table @code
154 @item TEXMF
155  To make sure that @TeX{} and lilypond find data files (among
156 others @file{.tex}, @file{.mf} and @file{.tfm}),
157 you have to set @code{TEXMF} to point to the lilypond data
158 file tree. A typical setting would be
159 @example
160 @{/usr/share/lilypond/1.6.0,@{!!/usr/share/texmf@}@}
161 @end example
164 @item GS_LIB
165 For processing PostScript output (obtained with
166 @code{-f ps}) with Ghostscript you have to set @code{GS_LIB} to
167 point to the directory containing library PS files.
169 @item GS_FONTPATH
170 For processing PostScript output (obtained with
171 @code{-f ps}) with Ghostscript you have to set @code{GS_FONTPATH} to
172 point to the directory containing  PFA files.
174 When you print direct PS output, remember to send the PFA files to the
175 printer as well.
176 @end table
179 @cindex ghostscript
180 @cindex PostScript
181 @cindex GS_FONTPATH
182 @cindex GS_LIB
183 @cindex TEXMF
184 @cindex printing postscript
186 The  binary itself recognizes the following environment variables
187 @table @code
188 @item LILYPONDPREFIX
189 This specifies a directory where locale messages and
190 data files will be looked up by default. The directory should contain
191 subdirectories called @file{ly/}, @file{ps/}, @file{tex/}, etc.
193 @item LANG
194 This selects the language for the warning messages 
195 @end table
197 @cindex LANG
198 @cindex LILYPONDPREFIX
203 @node Reporting bugs
204 @section Reporting bugs
206 @cindex bugs
207 @cindex reporting bugs
211 Since there is no finder's fee which doubles every year, there is no
212 need to wait for the prize money to grow. Send a bug report today!
214 Development moves quickly, so if you have a problem, it is
215 wise to check if it has been fixed in a newer release.  If not, please
216 send in a bugreport.  When you send us a bugreport, we have to
217 diagnose the problem and if necessary, duplicate it.  To make this
218 possible, it is important that you include the following information
219 in your report:
221 @itemize @bullet
223 @item A sample input which causes the error.  Please have mercy on the
224 developers, send a @emph{small} sample file.
226 @item The version number
228 @item A description of the platform you use (i.e., operating system,
229 system libraries, whether you downloaded a binary release)
231 @item If necessary, send a description of the bug itself.  If you
232 include output a ly2dvi run, please use @code{--debug} option of
233 ly2dvi.
235 @end itemize
237 You can send the report to @email{bug-lilypond@@gnu.org}.
239 @node Point and click
240 @section Point and click
241 @cindex poind and click
243 Point and click lets you find notes in the input by clicking on them in
244 the Xdvi window. This makes it easier to find input that causes some
245 error in the sheet music.
247 To use it, you need the following software
248 @itemize @bullet
249 @item A dvi viewer that supports src specials.
250 @itemize @bullet
251 @item Xdvi, version 22.36 or newer.  Available from
252 @uref{ftp://ftp.math.berkeley.edu/pub/Software/TeX/xdvi.tar.gz,ftp.math.berkeley.edu}.
254    Most @TeX{} distributions ship with xdvik, which is always
255   a few versions behind the official Xdvi. To find out which Xdvi you
256   are running, try @code{xdvi -version} or @code{xdvi.bin -version}.
257 @item KDVI.  A dvi viewer for KDE.  You need KDVI from KDE 3.0 or
258 newer.  Enable option @emph{Inverse search} in the menu @emph{Settings}.
260 Apparently, KDVI does not process PostScript specials correctly. Beams
261 and slurs will not be visible in KDVI.
263 @cindex Xdvi
264 @cindex KDVI
265 @cindex KDE
269 @end itemize
270 @item An editor with a client/server interface (or a lightweight GUI
271 editor).
273 @cindex editor
275 @itemize @bullet
276 @item Emacs. Emacs is an extensible text-editor.  It is available from
277 @uref{http://www.gnu.org/software/emacs/}.  You need version 21 to use
278 column location.
280 @c move this elsewhere?
282 There is also support for emacs: lilypond-mode for emacs provides
283 keyword autocompletion, indentation, LilyPond specific parenthesis
284 matching and syntax coloring, handy compile short-cuts and reading
285 LilyPond manuals using Info.  If lilypond-mode is not installed on
286 your platform, then refer to the installation instructions for more
287 information.
289 @cindex emacs
290 @cindex emacs mode
291 @cindex lilypond-mode for emacs
292 @cindex syntax coloring
294 @item XEmacs. Xemacs is very similar to emacs.
296 @cindex XEmacs
298 @item NEdit.  NEdit runs under Windows, and Unix.
299   It is available from @uref{http://www.nedit.org}.
301 @cindex NEdit
303 @item GVim.  GVim is a GUI variant of VIM, the popular VI
304 clone.  It is available from @uref{http://www.vim.org}.
306 @cindex GVim
307 @cindex Vim
309 @end itemize
310 @end itemize
313 Xdvi must be configured to find the @TeX{} fonts and music
314 fonts. Refer to the Xdvi documentation for more information.
316 To use point-and-click, add one of these lines to the top of your .ly
317 file.
318 @example
319 #(ly:set-point-and-click 'line)
320 @end example
321 @cindex line-location
323 When viewing, Control-Mousebutton 1 will take you to the originating
324 spot in the @file{.ly} file.  Control-Mousebutton 2 will show all
325 clickable boxes.
327 If you correct large files with point-and-click, be sure to start
328 correcting at the end of the file. When you start at the top, and
329 insert one line, all following locations will be off by a line.
331 @cindex Emacs
332 For using point-and-click with emacs,  add the following
333 In your emacs startup file (usually @file{~/.emacs}), 
334 @example
335 (server-start)
336 @end example
338 Make sure that the environment variable @var{XEDITOR} is set to
339 @example
340 emacsclient --no-wait +%l %f
341 @end example
342 @cindex @var{XEDITOR}
343 If you use xemacs instead of emacs, you use @code{(gnuserve-start)} in
344 your @file{.emacs}, and set @code{XEDITOR} to @code{gnuclient -q +%l %f}
346 For using Vim, set @code{XEDITOR} to @code{gvim --remote +%l %f}, or
347 use this argument with Xdvi's @code{-editor} option.
349 @cindex NEdit
350 For using NEdit, set @code{XEDITOR} to @code{nc -noask +%l %f}, or
351 use this argument with Xdvi's @code{-editor} option.
353 If can also make your editor jump to the exact location of the note
354 you clicked. This is only supported on Emacs and VIM. Users of Emacs version
355 20 must apply the patch @file{emacsclient.patch}. Users of version 21
356 must apply @file{server.el.patch} (version 21.2 and earlier).  At the
357 top of the @code{ly} file, replace the @code{set-point-and-click} line
358 with the following line,
359 @example
360 #(ly:set-point-and-click 'line-column)
361 @end example
362 @cindex line-colomn-location
363 and set @code{XEDITOR} to @code{emacsclient --no-wait +%l:%c %f}.  Vim
364 users can set @var{XEDITOR} to @code{gvim --remote +:%l:norm%c| %f}.
368 @refbugs
370 When you convert the @TeX{} file to PostScript using @code{dvips}, it
371 will complain about not finding @code{src:X:Y} files. These complaints
372 are harmless, and can be ignored.
376 @node Invoking ly2dvi
377 @section Invoking ly2dvi
379 Nicely titled output is created through a separate program:
380 @file{ly2dvi} is a script that uses LilyPond and La@TeX{} to create a
381 nicely titled piece of sheet music, in DVI format or PostScript.
383 @example
384         ly2dvi [@var{option}]@dots{} @var{file}@dots{}
385 @end example
387 To have ly2dvi read from stdin, use a dash @code{-} for @var{file}.
389 Ly2dvi supports the following options:
391 @table @code
392 @item -k,--keep
393     Keep the temporary directory including LilyPond and ly2dvi output
394 files. The temporary directory is created in the current directory as @code{ly2dvi.dir}.
395 @item -d,--dependencies
396     Write @code{Makefile} dependencies for every input file.
397 @item -h,--help
398     Print usage help.
399 @item -I,--include=@var{dir}
400     Add @var{dir} to LilyPond's include path.
401 @item -m,--no-paper
402     Produce MIDI output only.
403 @item --no-lily
404     Do not run LilyPond; useful for debugging ly2dvi.
405 @item -o,--output=@var{file}
406     Generate output to @var{file}.  The extension of @var{file} is ignored.
407 @item -P,--postscript
408     Also generate PostScript output, using dvips.  The postscript uses
409 the standard @TeX{} bitmap fonts for your printer.
410 @item -p,--pdf
411     Also generate Portable Document Format (PDF).  This option will
412 generate a PS file using scalable fonts, and will run the PS file
413 through @code{ps2pdf} producing a PDF file.
415 @cindex PDF
416 @cindex Scalable fonts
417     
418     If you use lilypond-book or your own wrapper files, do not use
419 @code{\usepackage[[T1]@{fontenc@}} in the file header but do not forget
420 @code{\usepackage[latin1]@{inputenc@}} if you use any other
421 non-anglosaxian characters.
423 @item --png
424     Also generate pictures of each page, in PNG format. 
425 @item --psgz
426     Gzip the postscript files
427 @item --html
428     Make a .HTML file with links to all output files.
429 @item --preview
430     Also generate a picture of the first system of the score.
432 @cindex preview
433 @cindex picture
434 @cindex bitmap
435 @cindex pixmap
436 @cindex thumbnail
437 @cindex screenshot
438     
439 @item -s,--set=@var{key}=@var{val}
440     Add @var{key}= @var{val} to the settings, overriding those specified
441 in the files. Possible keys: @code{language}, @code{latexheaders},
442 @code{latexpackages}, @code{latexoptions}, @code{papersize},
443 @code{pagenumber}, @code{linewidth}, @code{orientation},
444 @code{textheight}.
445 @item -v,--version
446 Show version information.
447 @item -V,--verbose
448 Be verbose.
449 @item --debug
450 Print even more information. This is useful when generating bugreports.
451 @item -w,--warranty
452 Show the warranty with which GNU LilyPond comes. (It comes with 
453 @strong{NO WARRANTY}!)
454 @end table
456 @subsection Titling layout
458 Ly2dvi extracts the following header fields from the LY files to
459 generate titling. An example demonstrating all these fields is in
460 @inputfileref{input/test,ly2dvi-testpage.ly}.
462 @table @code
463 @item title
464     The title of the music. Centered on top of the first page.
465 @item subtitle
466     Subtitle, centered below the title.
467 @item poet
468     Name of the poet, left flushed below the subtitle.
469 @item composer
470     Name of the composer, right flushed below the subtitle.
471 @item meter
472     Meter string, left flushed below the poet.
473 @item opus
474     Name of the opus, right flushed below the composer.
475 @item arranger
476     Name of the arranger, right flushed below the opus.
477 @item instrument
478     Name of the instrument, centered below the arranger
479 @item dedication            
480     To whom the piece is dedicated.
481 @item piece
482     Name of the piece, left flushed below the instrument
483 @item head
484     A text to print in the header of all pages. It is not called
485 @code{header}, because @code{\header} is a reserved word in LilyPond.
486 @item copyright
487     A text to print in the footer of the first page. Default is to 
488     print the standard footer also on the first page.
489 @item footer
490     A text to print in the footer of all but the last page.
491 @item tagline
492     Line to print at the bottom of last page. The default text is ``Lily
493 was here, @var{version-number}''.
494 @end table
497 @cindex header
498 @cindex footer
499 @cindex page layout
500 @cindex titles
504 @subsection Additional parameters
506 Ly2dvi responds to several parameters specified in a @code{\paper}
507 section of the input file. They can be overridden by supplying a
508 @code{--set} command line option.
510 @table @code
511 @item language
512     Specify La@TeX{} language: the @code{babel} package will be
513 included.  Default: unset.
515         Read from the @code{\header} block.
517 @item latexheaders
518     Specify additional La@TeX{} headers file.
520         Normally read from the @code{\header} block. Default value: empty
522 @item latexpackages
523     Specify additional La@TeX{} packages file. This works cumulative,
524 so you can add multiple packages using multiple @code{-s=latexpackages} options.
525        Normally read from the @code{\header} block. Default value:
526 @code{geometry}.
528 @item latexoptions
529     Specify additional options for the La@TeX{}
530 @code{\documentclass}. You can put any valid value here. This was
531 designed to allow ly2dvi to produce output for double-sided paper,
532 with balanced margins and pagenumbers on alternating sides. To achieve
533 this specify @code{twoside}
535 @item orientation
536     Set orientation. Choices are @code{portrait} or @code{landscape}. Is
537 read from the @code{\paper} block, if set.
538         
539 @item textheight
540     The vertical extension of the music on the page. It is normally 
541     calculated automatically, based on the paper size.
543 @item linewidth
544         The music line width. It is normally read from the @code{\paper}
545 block.
547 @item papersize
548    The paper size (as a name, e.g. @code{a4}). It is normally read from
549 the @code{\paper} block.
551 @item pagenumber
552    If set to @code{no}, no page numbers will be printed.  If set to a
553 positive integer, start with this value as the first page number.
555   
556   @item fontenc
557      The font encoding, should be set identical to the @code{font-encoding}
558      property in the score.
559 @end table