3.2.1 Structure of a score

A \score block must contain a single music expression delimited by curly brackets:

\score {
  …
}

Note: There must be only one outer music expression in a \score block, and it must be surrounded by curly brackets.

This single music expression may be of any size, and may contain other music expressions to any complexity. All of these examples are music expressions:

{ c'4 c' c' c' }
{
  { c'4 c' c' c' }
  { d'4 d' d' d' }
}

[image of music]

<<
  \new Staff { c'4 c' c' c' }
  \new Staff { d'4 d' d' d' }
>>

[image of music]

{
  \new GrandStaff <<
    \new StaffGroup <<
      \new Staff { \flute }
      \new Staff { \oboe }
    >>
    \new StaffGroup <<
      \new Staff { \violinI }
      \new Staff { \violinII }
    >>
  >>
}

Comments are one exception to this general rule. (For others see File structure.) Both single-line comments and comments delimited by %{ … %} may be placed anywhere within an input file. They may be placed inside or outside a \score block, and inside or outside the single music expression within a \score block.

Remember that even in a file containing only a \score block, it is implicitly enclosed in a \book block. A \book block in a source file produces at least one output file, and by default the name of the output file produced is derived from the name of the input file, so ‘fandangoforelephants.ly’ will produce ‘fandangoforelephants.pdf’.

(For more details about \book blocks, see Multiple scores in a book, Multiple output files from one input file, File structure.)

See also

Learning Manual: Working on input files, Music expressions explained, Score is a (single) compound musical expression.


LilyPond — Notation Reference v2.24.4 (stable-branch).