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