LilyPond will do page layout, set margins, and add headers and footers to each page.
The default layout responds to the following settings in the
\paper
block.
firstpagenumber
- The value of the page number of the first page. Default is 1.
printfirstpagenumber
- If set to true, will print the page number in the first page. Default is false.
printpagenumber
- If set to false, page numbers will not be printed.
hsize
- The width of the page.
vsize
- The height of the page.
topmargin
- Margin between header and top of the page.
bottommargin
- Margin between footer and bottom of the page.
leftmargin
- Margin between the left side of the page and the beginning of the music.
linewidth
- The length of the systems.
headsep
- Distance between the top-most music system and the page header.
footsep
- Distance between the bottom-most music system and the page footer.
raggedbottom
- If set to true, systems will not be spread across the page.
This should be set false for pieces that have only two or three systems per page, for example orchestral scores.
raggedlastbottom
- If set to false, systems will be spread to fill the last page.
Pieces that amply fill two pages or more should have this set to true.
betweensystemspace
- This dimensions determines the distance between systems. It is the ideal distance between the center of the bottom staff of one system and the center of the top staff of the next system.
Increasing this will provide a more even appearance of the page at the cost of using more vertical space.
betweensystempadding
- This dimension is the minimum amount of white space that will always be present between the bottom-most symbol of one system, and the top-most of the next system.
Increasing this will put systems whose bounding boxes almost touch farther apart.
aftertitlespace
- Amount of space between the title and the first system.
beforetitlespace
- Amount of space between the last system of the previous piece and the title of the next.
betweentitlespace
- Amount of space between consecutive titles (e.g., the title of the book and the title of a piece).
systemSeparatorMarkup
- This contains a markup object, which will be inserted between systems. This is often used for orchestral scores.
The markup command
\slashSeparator
is provided as a sensible default, for example
Example:
\paper{ hsize = 2\cm topmargin = 3\cm bottommargin = 3\cm raggedlastbottom = ##t }
You can also define these values in Scheme. In that case mm
,
in
, pt
, and cm
are variables defined in
paper-defaults.ly with values in millimeters. That's why the
value has to be multiplied in the example
\paper { #(define bottommargin (* 2 cm)) }
The default footer is empty, except for the first page, where the
copyright
field from \header
is inserted, and the last
page, where tagline
from \header
is added. The default
tagline is “Music engraving by LilyPond (version)”.1
The header and footer are created by the functions make-footer
and make-header
, defined in \paper
. The default
implementations are in scm/page-layout.scm.
The page layout itself is done by two functions in the
\paper
block, page-music-height
and
page-make-stencil
. The former tells the line-breaking algorithm
how much space can be spent on a page, the latter creates the actual
page given the system to put on it.
The option rightmargin is defined but doesn't set the right margin yet. The value for the right margin has to be defined adjusting the values of the leftmargin and linewidth.
The default page header puts the page number and the instrument
field from the \header
block on a line.
This page is for LilyPond-2.6.3 (stable-branch).