Next: How to read the manual, Previous: Simple notation, Up: First steps
LilyPond input files are similar to source files in many common
programming languages. They are case sensitive, and white-space
is generally ignored. Expressions are formed with curly braces
{ }, and comments are denoted with % or
%{ ... %}.
If the previous sentences sound like nonsense, don't worry! We'll explain what all these terms mean:
a, b, s, t) or upper case (e.g. A, B, S, T).
Notes are lower case: { c d e } is valid input;
{ C D E } will produce an error message.
{ c d e } means the same thing as
{ c d e } and:
{ c d
e }
Of course, the previous example is hard to read. A good rule of thumb is to indent code blocks with either a tab or two spaces:
{
c d e
}
() in mathematics. The braces should be surrounded by a
space unless they are at the beginning or end of a line to avoid
ambiguities.
A LilyPond command followed by a simple expression in braces (such
as \relative { }) also counts as a single music
expression.
% introduces a line comment; anything after % on
that line is ignored. By convention, a line comment is placed
above the code it refers to.
a4 a a a
% this comment refers to the Bs
b2 b
A block comment marks a whole section of music input as a comment.
Anything that is enclosed in %{ and %} is ignored.
However, block comments do not ‘nest’. This means that you
cannot place a block comment inside another block comment. If you
try, the first %} will terminate both block
comments. The following fragment shows possible uses for
comments:
% notes for twinkle twinkle follow
c4 c g' g a a g2
%{
This line, and the notes below are ignored,
since they are in a block comment.
f f e e d d c2
%}
This page is for LilyPond-2.11.58 (development-branch).
Report errors to http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs.
Your suggestions for the documentation are welcome.