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