5.1 General suggestions
Here are a few suggestions that can help to avoid (and fix) the most common problems when typesetting:
-
Always include a
\version
number in your input files no matter how small they are. This prevents having to remember which version of LilyPond the file was created with and is especially relevant when Updating files withconvert-ly
command (which requires the\version
statement to be present); or if sending your input files to other users (e.g. when asking for help on the mail lists). Note that all of the LilyPond templates contain\version
numbers. - For each line in your input file, write one bar of music. This will make debugging any problems in your input files much simpler.
- Include Bar and bar number checks as well as Octave checks. Including ‘checks’ of this type in your input files will help pinpoint mistakes more quickly. How often checks are added will depend on the complexity of the music being typeset. For simple compositions, checks added at a few at strategic points within the music can be enough but for more complex music, with many voices and/or staves, checks may be better placed after every bar.
- Add comments within input files. References to musical themes (i.e. ‘second theme in violins’, ‘fourth variation,’ etc.), or simply including bar numbers as comments, will make navigating the input file much simpler especically if something needs to be altered later on or if passing on LilyPond input files to another person.
-
Add explicit note durations at the start of ‘sections’. For
example,
c4 d e f
instead of justc d e f
can make rearranging the music later on simpler. -
Learn to indent and align braces and parallel music. Many
problems are often caused by either ‘missing’ braces. Clearly
indenting ‘opening’ and ‘closing’ braces (or
<<
and>>
indicators) will help avoid such problems. For example;\new Staff { \relative { r4 g'8 g c8 c4 d | e4 r8 | % Ossia section << { f8 c c | } \new Staff { f8 f c | } >> r4 | } }
is much easier to follow than;
\new Staff { \relative { r4 g'8 g c4 c8 d | e4 r8 % Ossia section << { f8 c c } \new Staff { f8 f c } >> r4 | } }
-
Keep music and style separate by putting overrides in the
\layout
block;\score { …music… \layout { \override TabStaff.Stemstencil = ##f } }
This will not create a new context but it will apply when one is created. Also see Saving typing with variables and functions, and Style sheets.
Other languages: català, deutsch, español, français, magyar, italiano, 日本語.
About automatic language selection.