lilypond-usage: General suggestions
5.1 General suggestions
=======================
Here are a few suggestions that can help you to avoid or fix problems:
• *Include ‘\version’ numbers in every file*. Note that all
templates contain ‘\version’ information. We highly recommend that
you always include the ‘\version’, no matter how small your file
is. Speaking from personal experience, it’s quite frustrating to
try to remember which version of LilyPond you were using a few
years ago. ‘convert-ly’ requires you to declare which version of
LilyPond you used.
• *Include checks*: (lilypond-notation)Bar and bar number
checks, (lilypond-notation)Octave checks. If you include
checks every so often, then if you make a mistake, you can pinpoint
it quicker. How often is ‘every so often’? It depends on the
complexity of the music. For very simple music, perhaps just once
or twice. For very complex music, perhaps every bar.
• *One bar per line of text*. If there is anything complicated,
either in the music itself or in the output you desire, it’s often
good to write only one bar per line. Saving screen space by
cramming eight bars per line just isn’t worth it if you have to
‘debug’ your input files.
• *Comment your input files*. Use either bar numbers (every so
often) or references to musical themes (‘second theme in violins,’
‘fourth variation,’ etc.). You may not need comments when you’re
writing the piece for the first time, but if you want to go back to
change something two or three years later, or if you pass the
source over to a friend, it will be much more challenging to
determine your intentions or how your file is structured if you
didn’t comment the file.
• *Indent your braces*. A lot of problems are caused by an imbalance
in the number of ‘{’ and ‘}’.
• *Explicitly add durations* at the beginnings of sections and
variables. If you specify ‘c4 d e’ at the beginning of a phrase
(instead of just ‘c d e’) you can save yourself some problems if
you rearrange your music later.
• *Separate tweaks* from music definitions. See
(lilypond-learning)Saving typing with variables and functions,
and (lilypond-learning)Style sheets.