Page formatting - GNU LilyPond
Description: GNU LilyPond

Previous: Paper size, Up: Paper and pages

#### 10.4.2 Page formatting

LilyPond will do page layout, set margins, and add headers and footers to each page.

To graphically display the dimensions of properties that may be altered for page formatting, use

    \paper {
      annotate-spacing = ##t
    }

All units dimensions are measured in staff spaces. The pairs (a,b) are intervals, where a is the lower edge and b the upper edge of the interval.

The default layout responds to the following settings in the `\paper` block.

> `first-page-number`
>   The value of the page number of the first page. Default is 1.

> `printfirst-page-number`
>   If set to true, will print the page number in the first page. Default is false.

> `print-page-number`
>   If set to false, page numbers will not be printed.

> `paper-width`
>   The width of the page.

> `paper-height`
>   The height of the page.

> `top-margin`
>   Margin between header and top of the page.

> `bottom-margin`
>   Margin between footer and bottom of the page.

> `left-margin`
>   Margin between the left side of the page and the beginning of the music.

> `line-width`
>   The length of the systems.

> `head-separation`
>   Distance between the top-most music system and the page header.

> `foot-separation`
>   Distance between the bottom-most music system and the page footer.

>   Distance from the top of the printable area to the center of the first staff. This only works for staves which are vertically small. Big staves are set with the top of their bounding box aligned to the top of the printable area.

> `ragged-bottom`
>   If set to true, systems will not be spread vertically across the page. This does not affect the last page.

>   This should be set to true for pieces that have only two or three systems per page, for example orchestral scores.

> `ragged-last-bottom`
>   If set to false, systems will be spread vertically to fill the last page.

>   Pieces that amply fill two pages or more should have this set to true.

> `system-count`
>   This variable, if set, specifies into how many lines a score should be broken.

> `between-system-space`
>   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.

> `between-system-padding`
>   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.

> `horizontal-shift`
>   All systems (including titles and system separators) are shifted by this amount to the right. Page markup, such as headers and footers are not affected by this. The purpose of this variable is to make space for instrument names at the left.

> `after-title-space`
>   Amount of space between the title and the first system.

> `before-title-space`
>   Amount of space between the last system of the previous piece and the title of the next.

> `between-title-space`
>   Amount of space between consecutive titles (e.g., the title of the book and the title of a piece).

> `printallheaders`
>   Setting this to #t will print all headers for each \score in a \book. Normally only the piece and opus \headers are printed.

> `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{
      paper-width = 2\cm
      top-margin = 3\cm
      bottom-margin = 3\cm
      ragged-last-bottom = ##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 bottom-margin (* 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 `ly/paper-defaults.ly` and `ly/titling-init.ly`.

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.

##### Bugs

The option right-margin is defined but doesn't set the right margin yet. The value for the right margin has to be defined adjusting the values of `left-margin` and `line-width`.

The default page header puts the page number and the `instrument` field from the `\header` block on a line.

The titles (from the `\header{}` section) are treated as a system, so `ragged-bottom` and `ragged-last-bottom` will add space between the titles and the first system of the score.

#### Footnotes

[1] Nicely printed parts are good PR for us, so please leave the tagline if you can.

This page is for LilyPond-2.8.8 (stable-branch).

Other languages: English.
Using automatic language selection.