1 @c -*- coding: utf-8; mode: texinfo; -*-
4 Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
6 When revising a translation, copy the HEAD committish of the
7 version that you are working on. For details, see the Contributors'
8 Guide, node Updating translation committishes..
14 @node Running lilypond
15 @chapter Running @command{lilypond}
17 This chapter details the technicalities of running LilyPond.
21 * Command-line usage::
30 Most users run LilyPond through a GUI; if you have not done so
31 already, please read the @rlearning{Tutorial}. If you use an alternate
32 editor to write lilypond files, see the documentation for that
36 @node Command-line usage
37 @section Command-line usage
39 This section contains extra information about using LilyPond on the
40 command-line. This may be desirable to pass extra options to the
41 program. In addition, there are certain extra @q{helper} programs (such
42 as @code{midi2ly}) which are only available on the command-line.
44 By @q{command-line}, we mean the command line in the operating system.
45 Windows users might be more familiar with the terms @q{DOS shell} or
46 @q{command shell}. MacOS@tie{}X users might be more familiar with the terms
47 @q{terminal} or @q{console}. Some additional setup is required
48 for MacOS@tie{}X users; please see @rweb{MacOS X}.
50 Describing how to use this part of an operating system is outside the
51 scope of this manual; please consult other documentation on this topic
52 if you are unfamiliar with the command-line.
56 * Basic command line options for LilyPond::
57 * Advanced command line options for LilyPond::
58 * Environment variables::
59 * LilyPond in chroot jail::
62 @node Invoking lilypond
63 @unnumberedsubsec Invoking @command{lilypond}
65 The @command{lilypond} executable may be called as follows from
69 lilypond [@var{option}]@dots{} @var{file}@dots{}
73 When invoked with a filename that has no extension, the @file{.ly}
74 extension is tried first. To read input from stdin, use a
75 dash (@code{-}) for @var{file}.
77 When @file{filename.ly} is processed it will produce @file{filename.ps}
78 and @file{filename.pdf} as output. Several files can be specified;
79 they will each be processed independently. @footnote{The status of
80 GUILE is not reset after processing a @code{.ly} file, so be careful
81 not to change any system defaults from within Scheme.}
83 If @file{filename.ly} contains more than one @code{\book}
84 block, then the rest of the scores will be output in numbered files,
85 starting with @file{filename-1.pdf}. In addition, the value of
86 @code{output-suffix} will be inserted between the basename and the
87 number. An input file containing
90 #(define output-suffix "violin")
92 #(define output-suffix "cello")
97 will output @var{base}@file{-violin.pdf} and
98 @var{base}@file{-cello-1.pdf}.
101 @unnumberedsubsubsec Standard shell commands
103 If your shell (i.e. command window) supports normal redirects,
104 then you might find it useful to use the following commands to
105 redirect console output to a file:
110 @code{lilypond file.ly 1>stdout.log} to redirect normal output
113 @code{lilypond file.ly 2>stderr.log} to redirect error messages
116 @code{lilypond file.ly &>all.log} to redirect all output
120 Consult the documentation for your shell to see if it supports these
121 options, or if the syntax is different. Note that these are shell
122 commands and have nothing to do with lilypond.
125 @node Basic command line options for LilyPond
126 @unnumberedsubsec Basic command line options for LilyPond
128 @cindex Invoking @command{lilypond}
129 @cindex command line options for @command{lilypond}
130 @cindex options, command line
133 The following options are supported:
137 @item -d,--define-default=@var{var}=@var{val}
138 See @ref{Advanced command line options for LilyPond}.
140 @cindex Scheme, expression evaluation
141 @cindex expression evaluation, Scheme
143 @item -e,--evaluate=@var{expr}
144 Evaluate the Scheme @var{expr} before parsing any @file{.ly} files.
145 Multiple @option{-e} options may be given, they will be evaluated
148 The expression will be evaluated in the @code{guile-user} module, so
149 if you want to use definitions in @var{expr}, use
152 lilypond -e '(define-public a 42)'
156 on the command-line, and include
159 #(use-modules (guile-user))
163 at the top of the @code{.ly} file.
165 @warning{Windows users must use double quotes instead of single quotes.}
167 @cindex output, format
168 @cindex format, output
170 @item -f,--format=@var{format}
171 which formats should be written. Choices for @code{format} are
172 @code{ps}, @code{pdf}, and @code{png}.
174 Example: @code{lilypond -fpng @var{filename}.ly}
177 Show a summary of usage.
179 @item -H,--header=@var{FIELD}
180 Dump a header field to file @file{BASENAME.@var{FIELD}}.
182 @item -i,--init=@var{file}
183 Set init file to @var{file} (default: @file{init.ly}).
185 @cindex file searching
188 @item -I, --include=@var{directory}
189 Add @var{directory} to the search path for input files.
191 Multiple -I options may be given. The search will start in the first
192 defined directory, and if the file to be included is not found the
193 search will continue in subsequent directories.
195 @cindex chroot jail, running inside
197 @item -j,--jail=@var{user},@var{group},@var{jail},@var{dir}
198 Run @command{lilypond} in a chroot jail.
200 The @option{--jail} option provides a more flexible alternative to
201 @option{-dsafe}, when LilyPond formatting is being provided via a web
202 server, or whenever LilyPond executes commands sent by external sources
203 (see @ref{Advanced command line options for LilyPond}).
205 It works by changing the root of @command{lilypond} to @var{jail} just
206 before starting the actual compilation process. The user and group are
207 then changed to match those provided, and the current directory is
208 changed to @var{dir}. This setup guarantees that it is not possible (at
209 least in theory) to escape from the jail. Note that for @option{--jail}
210 to work, @command{lilypond} must be run as root, which is usually
211 accomplished in a safe way using @command{sudo}.
213 Setting up a jail can be a relatively complex matter, as we must be sure
214 that LilyPond is able to find whatever it needs to compile the source
215 @emph{inside} the jail itself. A typical chroot jail will comprise the
220 @item Setting up a separate filesystem
221 A separate filesystem should be created for LilyPond, so that it can be
222 mounted with safe options such as @code{noexec}, @code{nodev}, and
223 @code{nosuid}. In this way, it is impossible to run executables or to
224 write directly to a device from LilyPond. If you do not want to create a
225 separate partition, just create a file of reasonable size and use it to
226 mount a loop device. A separate filesystem also guarantees that LilyPond
227 cannot write more space than it is allowed.
229 @item Setting up a separate user
230 A separate user and group (say, @code{lily}/@code{lily}) with low
231 privileges should be used to run LilyPond inside the jail. There should
232 be a single directory writable by this user, which should be passed in
235 @item Preparing the jail
236 LilyPond needs to read a number of files while running. All these files
237 are to be copied into the jail, under the same path they appear in the
238 real root filesystem. The entire content of the LilyPond installation
239 (e.g., @file{/usr/share/lilypond}) should be copied.
241 If problems arise, the simplest way to trace them down is to run
242 LilyPond using @command{strace}, which will allow you to determine which
245 @item Running LilyPond
246 In a jail mounted with @code{noexec} it is impossible to execute any
247 external program. Therefore LilyPond must be run with a backend that
248 does not require any such program. As we have already mentioned, it
249 must be run with superuser privileges (which, of course, it will lose
250 immediately), possibly using @command{sudo}. It is also good practice
251 to limit the number of seconds of CPU time LilyPond can use (e.g., using
252 @command{ulimit@tie{}-t}), and, if your operating system supports it,
253 the amount of memory that can be allocated. Also see
254 @ref{LilyPond in chroot jail}.
258 @cindex output, verbosity
260 @item -l,--loglevel=@var{LEVEL}
261 Set the verbosity of the console output to @var{LEVEL}. Possible values
267 No output at all, not even error messages.
270 Only error messages, no warnings or progress messages.
273 Warnings and error messages, no progress.
276 Basic progress messages (success), warnings and errors.
279 All progress messages, warnings and errors.
282 Progress messages, warnings, errors and further execution information.
285 All possible messages, including verbose debug output.
289 @cindex directory, redirect output
290 @cindex output, setting filename
291 @cindex output, directory
293 @item -o,--output=@var{FILE} or @var{FOLDER}
294 Set the default output file to @var{FILE} or, if a folder with that name
295 exists, direct the output to @var{FOLDER}, taking the file name from the
296 input file. The appropriate suffix will be added (e.g. @code{.pdf} for
299 @cindex PS (Postscript), output
300 @cindex Postscript (PS), output
301 @cindex output, PS (Postscript)
306 @cindex PNG (Portable Network Graphics), output
307 @cindex output, PNG (Portable Network Graphics)
310 Generate pictures of each page, in PNG format. This implies
311 @option{--ps}. The resolution in DPI of the image may be set with
316 @cindex PDF (Portable Document Format), output
317 @cindex output, PDF (Portable Document Format)
320 Generate PDF. This implies @option{--ps}.
323 Show version information.
326 Be verbose: show full paths of all files read, and give timing
330 Show the warranty with which GNU LilyPond comes. (It comes with
331 @strong{NO WARRANTY}!)
336 @node Advanced command line options for LilyPond
337 @unnumberedsubsec Advanced command line options for LilyPond
341 @item -d@var{[option-name]}=@var{[value]},--define-default=@var{[option-name]}=@var{[value]}
342 This sets the equivalent internal Scheme function to @var{value}.
348 If a @var{value} is not supplied, then the default value is used. The
349 prefix @code{no-} may be added to @var{option-name} to switch @q{off} an
352 @cindex point and click, command line
365 @noindent The following are supported along with their respective
368 @multitable @columnfractions .33 .16 .51
369 @item @strong{Symbol}
371 @tab @strong{Explanation/Options}
373 @item @code{anti-alias-factor}
375 @tab Render at higher resolution (using given factor) and scale down
376 result to prevent @q{jaggies} in @code{PNG} images.
378 @item @code{aux-files}
380 @tab Create @code{.tex}, @code{.texi}, @code{.count} files in the
385 @tab Select backend. Postscript files (default) include @code{TTF},
386 @code{Type1} and @code{OTF} fonts. No subsetting of these fonts is
387 done. Using @q{oriental} character sets can lead to very large files.
391 @tab Encapsulated PostScript. This dumps every page (system) as a
392 separate @file{EPS} file, without fonts, and as one collated @file{EPS}
393 file with all pages (systems) including fonts. Used as default by
394 @command{lilypond-book}.
398 @tab Do not output a printed score; has the same effect as
399 @code{-dno-print-pages}.
403 @tab Scalable Vector Graphics. This creates a single @code{SVG} file,
404 without embedded fonts, for every page of output. It is recommended to
405 install the Century Schoolbook fonts, included with your LilyPond
406 installation, for optimal rendering. Under UNIX, simply copy these
407 fonts from the LilyPond directory (typically
408 @file{/usr/share/lilypond/VERSION/fonts/otf/}) to @file{~/.fonts/}. The
409 @code{SVG} output should be compatible with any SVG editor or user
410 agent. There is also an option @code{svg-woff} (below) for use of woff
411 font files in the SVG backend.
415 @tab Dump of the raw, internal Scheme-based drawing commands.
417 @item @code{check-internal-types}
419 @tab Check every property assignment for types.
421 @item @code{clip-systems}
423 @tab Generate cut-out snippets of a score.
427 @tab Prefix for data files (read-only).
429 @item @code{debug-gc}
431 @tab Dump memory debugging statistics.
433 @item @code{debug-gc-assert-parsed-dead}
435 @tab For memory debugging: Ensure that all references to parsed objects
436 are dead. This is an internal option, and is switched on automatically
437 for @code{`-ddebug-gc'}.
439 @item @code{debug-lexer}
441 @tab Debug the flex lexer.
443 @item @code{debug-page-breaking-scoring}
445 @tab Dump scores for many different page breaking configurations.
447 @item @code{debug-parser}
449 @tab Debug the bison parser.
451 @item @code{debug-property-callbacks}
453 @tab Debug cyclic callback chains.
455 @item @code{debug-skylines}
459 @item @code{delete-intermediate-files}
461 @tab Delete the unusable, intermediate @code{.ps} files created during
464 @item @code{dump-cpu-profile}
466 @tab Dump timing information (system-dependent).
468 @item @code{dump-profile}
470 @tab Dump memory and time information for each file.
472 @item @code{dump-signatures}
474 @tab Dump output signatures of each system. Used for regression testing.
476 @item @code{eps-box-padding}
478 @tab Pad left edge of the output EPS bounding box by the given amount
481 @item @code{gs-load-fonts}
483 @tab Load fonts via Ghostscript.
485 @item @code{gs-load-lily-fonts}
487 @tab Load only the LilyPond fonts via Ghostscript.
491 @tab Runs silently and redirect all output to a log file.
495 @strong{Note to Windows users:} By default @code{lilypond.exe} outputs
496 all progress information to the command window,
497 @code{lilypond-windows.exe} does not and returns a prompt, with no
498 progress information, immediately at the command line. The
499 @option{-dgui} option can be used in this case to redirect output to a
502 @multitable @columnfractions .33 .16 .51
507 @item @code{include-book-title-preview}
509 @tab Include book titles in preview images.
511 @item @code{include-eps-fonts}
513 @tab Include fonts in separate-system EPS files.
515 @item @code{include-settings}
517 @tab Include file for global settings, this is included before the score
520 @item @code{job-count}
522 @tab Process in parallel, using the given number of jobs.
524 @item @code{log-file}
525 @tab @code{#f [file]}
526 @tab If string @code{FOO} is given as a second argument,
527 redirect output to the log file @code{FOO.log}.
529 @item @code{max-markup-depth}
531 @tab Maximum depth for the markup tree. If a markup has more levels,
532 assume it will not terminate on its own, print a warning and return a
535 @item @code{midi-extension}
537 @tab Set the default file extension for MIDI output file to given
540 @item @code{music-strings-to-paths}
542 @tab Convert text strings to paths when glyphs belong to a music font.
544 @item @code{old-relative}
546 @tab Make @code{\relative} mode for simultaneous music work similar to
549 @item @code{paper-size}
551 @tab Set default paper size. Note the string must be enclosed in
552 escaped double quotes.
554 @item @code{pixmap-format}
556 @tab Set GhostScript's output format for pixel images.
558 @item @code{point-and-click}
560 @tab Add @q{point & click} links to @code{PDF} output. See
561 @ref{Point and click}.
565 @tab Create preview images in addition to normal output.
569 This option is supported by all backends; @code{pdf}, @code{png},
570 @code{ps}, @code{eps} and @code{svg}, but not @code{scm}. It generates
571 an output file, in the form @code{myFile.preview.extension}, containing
572 the titles and the first system of music. If @code{\book} or
573 @code{\bookpart} blocks are used, the titles of @code{\book},
574 @code{\bookpart} or @code{\score} will appear in the output, including
575 the first system of every @code{\score} block if the @code{\paper}
576 variable @code{print-all-headers} is set to @code{#t}.
578 To suppress the usual output, use the @option{-dprint-pages} or
579 @option{-dno-print-pages} options according to your requirements.
581 @multitable @columnfractions .33 .16 .51
582 @item @code{print-pages}
584 @tab Generate full pages, the default. @option{-dno-print-pages} is
585 useful in combination with @option{-dpreview}.
587 @item @code{profile-property-accesses}
589 @tab Keep statistics of @code{get_property()} function calls.
591 @item @code{protected-scheme-parsing}
593 @tab Continue when errors in inline scheme are caught in the parser. If
594 set to @code{#f}, halt on errors and print a stack trace.
596 @item @code{read-file-list}
597 @tab @code{#f [file]}
598 @tab Specify name of a file which contains a list of input files to be
601 @item @code{relative-includes}
603 @tab When processing an @code{\include} command, look for the included
604 file relative to the current file (instead of the root file).
606 @item @code{resolution}
608 @tab Set resolution for generating @code{PNG} pixmaps to given value (in
613 @tab Do not trust the @code{.ly} input.
617 When LilyPond formatting is available through a web server, either the
618 @option{--safe} or the @option{--jail} option @b{MUST} be passed. The
619 @option{--safe} option will prevent inline Scheme code from wreaking
626 c4^$(ly:gulp-file "/etc/passwd")
631 The @option{-dsafe} option works by evaluating in-line Scheme
632 expressions in a special safe module. This is derived from GUILE
633 @file{safe-r5rs} module, but also adds a number of functions of the
634 LilyPond API which are listed in @file{scm/safe-lily.scm}.
636 In addition, safe mode disallows @code{\include} directives and
637 disables the use of backslashes in @TeX{} strings. It is also not
638 possible to import LilyPond variables into Scheme while in safe mode.
640 @option{-dsafe} does @emph{not} detect resource overuse, so it is still
641 possible to make the program hang indefinitely, for example by feeding
642 cyclic data structures into the backend. Therefore, if using LilyPond
643 on a publicly accessible webserver, the process should be limited in
644 both CPU and memory usage.
646 Safe mode will prevent many useful LilyPond snippets from being
649 The @option{--jail} is an even more secure alternative, but requires
650 more work to set up. See @ref{Basic command line options for LilyPond}.
652 @multitable @columnfractions .33 .16 .51
653 @item @code{separate-log-files}
655 @tab For input files @code{FILE1.ly}, @code{FILE2.ly}, etc. output log
656 data to files @code{FILE1.log}, @code{FILE2.log}, ...
658 @item @code{show-available-fonts}
660 @tab List available font names.
662 @item @code{strict-infinity-checking}
664 @tab Force a crash on encountering @code{Inf} and @code{NaN} floating
667 @item @code{strip-output-dir}
669 @tab Don't use directories from input files while constructing output
672 @item @code{svg-woff}
674 @tab Use woff font files in SVG backend.
676 @item @code{trace-memory-frequency}
678 @tab Record Scheme cell usage this many times per second. Dump the
679 results to @code{FILE.stacks} and @code{FILE.graph}.
681 @item @code{trace-scheme-coverage}
683 @tab Record coverage of Scheme files in @code{FILE.cov}.
687 @tab Verbose output, i.e. loglevel at DEBUG (read-only).
689 @item @code{warning-as-error}
691 @tab Change all warning and @q{programming error} messages into errors.
695 @node Environment variables
696 @unnumberedsubsec Environment variables
699 @cindex LILYPOND_DATADIR
701 @command{lilypond} recognizes the following environment variables:
703 @item LILYPOND_DATADIR
704 This specifies a directory where locale messages and
705 data files will be looked up by default. The directory should contain
706 subdirectories called @file{ly/}, @file{ps/}, @file{tex/}, etc.
709 This selects the language for the warning messages.
711 @item LILYPOND_LOGLEVEL
712 The default loglevel. If LilyPond is called without an explicit loglevel
713 (i.e. no @option{--loglevel} command line option), this value is used.
715 @item LILYPOND_GC_YIELD
716 A variable, as a percentage, that tunes memory management
717 behavior. A higher values means the program uses more memory, a
718 smaller value means more CPU time is used. The default value is
724 @node LilyPond in chroot jail
725 @unnumberedsubsec LilyPond in chroot jail
727 Setting up the server to run LilyPond in a chroot jail is a complicated
728 task. The steps are listed below. Examples in the steps are from
729 Ubuntu GNU/Linux, and may require the use of @code{sudo} as appropriate.
733 @item Install the necessary packages: LilyPond, GhostScript, and ImageMagick.
735 @item Create a new user by the name of @code{lily}:
742 This will create a new group for the @code{lily} user as well, and a
743 home folder, @code{/home/lily}
745 @item In the home folder of the @code{lily} user create a file to use as a
749 dd if=/dev/zero of=/home/lily/loopfile bs=1k count= 200000
753 This example creates a 200MB file for use as the jail filesystem.
755 @item Create a loop device, make a file system and mount it, then create
756 a folder that can be written by the @code{lily} user:
760 losetup /dev/loop0 /home/lily/loopfile
761 mkfs -t ext3 /dev/loop0 200000
762 mount -t ext3 /dev/loop0 /mnt/lilyloop
763 mkdir /mnt/lilyloop/lilyhome
764 chown lily /mnt/lilyloop/lilyhome
767 @item In the configuration of the servers, the JAIL will be @code{/mnt/lilyloop}
768 and the DIR will be @code{/lilyhome}.
770 @item Create a big directory tree in the jail by copying the necessary files, as
771 shown in the sample script below.
773 You can use @code{sed} to create the necessary copy commands for a given
777 for i in "/usr/local/lilypond/usr/bin/lilypond" "/bin/sh" "/usr/bin/; \
778 do ldd $i | sed 's/.*=> \/\(.*\/\)\([^(]*\).*/mkdir -p \1 \&\& \
779 cp -L \/\1\2 \1\2/' | sed 's/\t\/\(.*\/\)\(.*\) (.*)$/mkdir -p \
780 \1 \&\& cp -L \/\1\2 \1\2/' | sed '/.*=>.*/d'; done
785 @subheading Example script for 32-bit Ubuntu 8.04
793 loopdevice=/dev/loop0
794 jaildir=/mnt/lilyloop
795 # the prefix (without the leading slash!)
797 # the directory where lilypond is installed on the system
798 lilydir=/$lilyprefix/lilypond/
800 userhome=$home/$username
801 loopfile=$userhome/loopfile
803 dd if=/dev/zero of=$loopfile bs=1k count=200000
805 losetup $loopdevice $loopfile
806 mkfs -t ext3 $loopdevice 200000
807 mount -t ext3 $loopdevice $jaildir
808 mkdir $jaildir/lilyhome
809 chown $username $jaildir/lilyhome
812 mkdir -p bin usr/bin usr/share usr/lib usr/share/fonts $lilyprefix tmp
815 cp -r -L $lilydir $lilyprefix
816 cp -L /bin/sh /bin/rm bin
817 cp -L /usr/bin/convert /usr/bin/gs usr/bin
818 cp -L /usr/share/fonts/truetype usr/share/fonts
820 # Now the library copying magic
821 for i in "$lilydir/usr/bin/lilypond" "$lilydir/usr/bin/guile" "/bin/sh" \
822 "/bin/rm" "/usr/bin/gs" "/usr/bin/convert"; do ldd $i | sed 's/.*=> \
823 \/\(.*\/\)\([^(]*\).*/mkdir -p \1 \&\& cp -L \/\1\2 \1\2/' | sed \
824 's/\t\/\(.*\/\)\(.*\) (.*)$/mkdir -p \1 \&\& cp -L \/\1\2 \1\2/' \
825 | sed '/.*=>.*/d'; done | sh -s
827 # The shared files for ghostscript...
828 cp -L -r /usr/share/ghostscript usr/share
829 # The shared files for ImageMagick
830 cp -L -r /usr/lib/ImageMagick* usr/lib
832 ### Now, assuming that you have test.ly in /mnt/lilyloop/lilyhome,
833 ### you should be able to run:
834 ### Note that /$lilyprefix/bin/lilypond is a script, which sets the
835 ### LD_LIBRARY_PATH - this is crucial
836 /$lilyprefix/bin/lilypond -jlily,lily,/mnt/lilyloop,/lilyhome test.ly
839 @c " keep quote signs balanced for context-sensitive editors
842 @section Error messages
844 @cindex error messages
845 Different error messages can appear while compiling a file:
851 Something looks suspect. If you are requesting something out of the
852 ordinary then you will understand the message, and can ignore it.
853 However, warnings usually indicate that something is wrong with the
858 Something is definitely wrong. The current processing step (parsing,
859 interpreting, or formatting) will be finished, but the next step will
864 Something is definitely wrong, and LilyPond cannot continue. This
865 happens rarely. The most usual cause is misinstalled fonts.
868 @cindex trace, Scheme
871 Errors that occur while executing Scheme code are caught by the Scheme
872 interpreter. If running with the verbose option (@option{-V} or
873 @option{--verbose}) then a call trace of the offending
874 function call is printed.
876 @item Programming error
877 @cindex Programming error
878 There was some internal inconsistency. These error messages are
879 intended to help the programmers and debuggers. Usually, they can be
880 ignored. Sometimes, they come in such big quantities that they obscure
883 @item Aborted (core dumped)
884 @cindex Aborted (core dumped)
885 This signals a serious programming error that caused the program to
886 crash. Such errors are considered critical. If you stumble on one,
890 @cindex errors, message format
891 If warnings and errors can be linked to some part of the input file,
892 then error messages have the following form
895 @var{filename}:@var{lineno}:@var{columnno}: @var{message}
896 @var{offending input line}
899 A line-break is inserted in the offending line to indicate the column
900 where the error was found. For example,
903 test.ly:2:19: error: not a duration: 5
908 These locations are LilyPond's best guess about where the warning or
909 error occurred, but (by their very nature) warnings and errors occur
910 when something unexpected happens. If you can't see an error in the
911 indicated line of your input file, try checking one or two lines
912 above the indicated position.
914 More information about errors is given in @ref{Common errors}.
918 @section Common errors
920 The error conditions described below occur often, yet the cause
921 is not obvious or easily found. Once seen and understood, they
926 * Music runs off the page::
927 * An extra staff appears::
928 * Error message Unbound variable %::
929 * Error message FT_Get_Glyph_Name::
930 * Warning staff affinities should only decrease::
933 @node Music runs off the page
934 @unnumberedsubsec Music runs off the page
936 Music running off the page over the right margin or appearing
937 unduly compressed is almost always due to entering an incorrect
938 duration on a note, causing the final note in a measure to extend
939 over the bar line. It is not invalid if the final note in a
940 measure does not end on the automatically entered bar line, as the
941 note is simply assumed to carry over into the next measure. But
942 if a long sequence of such carry-over measures occurs the music
943 can appear compressed or may flow off the page because automatic
944 line breaks can be inserted only at the end of complete measures,
945 i.e., where all notes end before or at the end of the measure.
947 @warning{An incorrect duration can cause line breaks to be
948 inhibited, leading to a line of highly compressed music or
949 music which flows off the page.}
951 The incorrect duration can be found easily if bar checks are used,
952 see @ruser{Bar and bar number checks}.
954 If you actually intend to have a series of such carry-over measures
955 you will need to insert an invisible bar line where you want the
956 line to break. For details, see @ruser{Bar lines}.
959 @node An extra staff appears
960 @unnumberedsubsec An extra staff appears
962 If contexts are not created explicitly with @code{\new} or
963 @code{\context}, they will be silently created as soon as a
964 command is encountered which cannot be applied to an existing
965 context. In simple scores the automatic creation of contexts is
966 useful, and most of the examples in the LilyPond manuals take
967 advantage of this simplification. But occasionally the silent
968 creation of contexts can give rise to unexpected new staves or
969 scores. For example, it might be expected that the following code
970 would cause all note heads within the following staff to be
971 colored red, but in fact it results in two staves with the note
972 heads remaining the default black in the lower staff.
974 @lilypond[quote,verbatim,relative=2]
975 \override Staff.NoteHead.color = #red
979 This is because a @code{Staff} context does not exist when the
980 override is processed, so one is implicitly created and the override
981 is applied to it, but then the @code{\new Staff} command creates
982 another, separate, staff into which the notes are placed. The
983 correct code to color all note heads red is
985 @lilypond[quote,verbatim,relative=2]
987 \override Staff.NoteHead.color = #red
992 As a second example, if a @code{\relative} command is placed inside
993 a @code{\repeat} command, two staves result, the second offset from
994 the first, because the @code{\repeat} command generates two
995 @code{\relative} blocks, which each implicitly create @code{Staff}
996 and @code{Voice} blocks.
998 @lilypond[quote,verbatim]
1000 \relative c' { c4 d e f }
1004 Explicitly instantiating the @code{Voice} context fixes the
1007 @lilypond[quote,verbatim]
1010 \relative c' { c4 d e f }
1016 @node Error message Unbound variable %
1017 @unnumberedsubsec Error message Unbound variable %
1019 This error message will appear at the bottom of the console
1020 output or log file together with a @qq{GUILE signalled an error @dots{}}
1021 message every time a Scheme routine is called which (invalidly)
1022 contains a @emph{LilyPond} rather than a @emph{Scheme} comment.
1024 LilyPond comments begin with a percent sign, (@code{%}), and must
1025 not be used within Scheme routines. Scheme comments begin with a
1026 semi-colon, (@code{;}).
1028 @node Error message FT_Get_Glyph_Name
1029 @unnumberedsubsec Error message FT_Get_Glyph_Name
1031 This error messages appears in the console output or log file if
1032 an input file contains a non-ASCII character and was not saved in
1033 UTF-8 encoding. For details, see @ruser{Text encoding}.
1036 @node Warning staff affinities should only decrease
1037 @unnumberedsubsec Warning staff affinities should only decrease
1038 This warning can appear if there are no staves in the printed
1039 output, for example if there are just a @code{ChordName} context
1040 and a @code{Lyrics} context as in a lead sheet. The warning
1041 messages can be avoided by making one of the contexts behave as a
1045 \override VerticalAxisGroup.staff-affinity = ##f
1049 at its start. For details, see @qq{Spacing of non-staff lines} in
1050 @ruser{Flexible vertical spacing within systems}.