3.1.5 File structure

A ‘.ly’ file may contain any number of toplevel expressions, where a toplevel expression is one of the following:

The following example shows three things that may be entered at toplevel

\layout {
  % Don't justify the output
  ragged-right = ##t

\header {
   title = "Do-re-mi"

{ c'4 d' e2 }

At any point in a file, any of the following lexical instructions can be entered:

Whitespace between items in the input stream is generally ignored, and may be freely omitted or extended to enhance readability. However, whitespace should always be used in the following circumstances to avoid errors:

See also

Learning Manual: How LilyPond input files work.

Notation Reference: Titles explained, The \layout block.

LilyPond — Notation Reference v2.21.82 (development-branch).