LilyPond Notation Reference: 3.2.1 Creating titles, headers, and footers

### 3.2.1 Creating titles, headers, and footers

#### Title blocks explained

There are two types of title blocks: the main title block that appears above of the first `\score` of a book, and individual title blocks that appear within each `\score` block. Text fields for both types are entered using a `\header` block.

If the book only has a single score, the `\header` block may be placed inside or outside of the `\score` block.

Note: Remember when adding a \`header` block inside a \`score` block, that the music expression must come before the \`header` block.

>     \header {
>       title = "SUITE I."
>       composer = "J. S. Bach."
>     }

>     \score {
>       \new Staff \relative g, {
>         \clef bass
>         \key g \major
>         \repeat unfold 2 { g16( d' b') a b d, b' d, } |
>         \repeat unfold 2 { g,16( e' c') b c e, c' e, } |
>       }
>       \header {
>         piece = "Prélude."
>       }
>     }

>     \score {
>       \new Staff \relative b {
>         \clef bass
>         \key g \major
>         \partial 16 b16 |
>         <g, d' b'~>4 b'16 a( g fis) g( d e fis) g( a b c) |
>         d16( b g fis) g( e d c) b(c d e) fis( g a b) |
>       }
>       \header {
>         piece = "Allemande."
>       }
>     }

Text fields from the main title block of a book can be displayed in all `\score` blocks, or manually suppressed:

>     \book {
>       \paper {
>         print-all-headers = ##t
>       }
>       \header {
>         title = "DAS WOHLTEMPERIRTE CLAVIER"
>         subtitle = "TEIL I"
>         % Do not display the tagline for this book
>         tagline = ##f
>       }
>       \markup { \vspace #1 }
>       \score {
>         \new PianoStaff <<
>           \new Staff { s1 }
>           \new Staff { \clef "bass" s1 }
>         >>
>         \header {
>           title = "PRAELUDIUM I"
>           opus = "BWV 846"
>           % Do not display the subtitle for this score
>           subtitle = ##f
>         }
>       }
>       \score {
>         \new PianoStaff <<
>           \new Staff { s1 }
>           \new Staff { \clef "bass" s1 }
>         >>
>         \header {
>           title = "FUGA I"
>           subsubtitle = "A 4 VOCI"
>           opus = "BWV 846"
>           % Do not display the subtitle for this score
>           subtitle = ##f
>         }
>       }
>     }

#### See also

Notation Reference: File structure, Custom layout for title blocks.

#### Default layout of book and score title blocks

The layout and formatting of title blocks are controlled by two `\paper` variables; `bookTitleMarkup` for the main `\header` title block and `scoreTitleMarkup` for individual `\header` blocks within a `\score`.

>     \header {
>       % The following fields are centered
>       dedication = "Dedication"
>       title = "Title"
>       subtitle = "Subtitle"
>       subsubtitle = "Subsubtitle"
>       instrument = "Instrument"

>       % The following fields are left-aligned on the left side
>       poet = "Poet"
>       meter = "Meter"

>       % The following fields are right-aligned on the right side
>       composer = "Composer"
>       arranger = "Arranger"
>     }

>     \score {
>       { s1 }
>       \header {
>         % The following fields are placed at opposite ends of the same line
>         piece = "Piece"
>         opus = "Opus"
>       }
>     }

Text fields left unset in a `\header` block are replaced with `\null` markups so that the space is not wasted.

The default settings for `scoreTitleMarkup` place the `piece` and `opus` text fields at opposite ends of the same line.

Use the `breakbefore` variable inside a `\header` block that is itself in a `\score` block, to make the top-level `\header` block titles appear on the first page on their own, with the music (defined in the `\score` block) starting on the next.

    \book {
      \header {
        title = "This is my Title"
        subtitle = "This is my Subtitle"
        copyright = "This is the bottom of the first page"
      }
      \score {
        \repeat unfold 4 { e'' e'' e'' e'' }
        \header {
          piece = "This is the Music"
          breakbefore = ##t
        }
      }
    }

#### See also

Learning Manual: How LilyPond input files work,

Notation Reference: File structure.

Installed Files: ‘`ly/titling-init.ly`’.

#### Default layout of headers and footers

Headers and footers are lines of text appearing at the top and bottom of pages, separate from the main text of a book. They are controlled by the following `\paper` variables:

- `oddHeaderMarkup`
- `evenHeaderMarkup`
- `oddFooterMarkup`
- `evenFooterMarkup`

These markup variables can only access text fields from top-level `\header` blocks (which apply to all scores in the book) and are defined in ‘`ly/titling-init.ly`’. By default:

- page numbers are automatically placed on the top far left (if even) or top far right (if odd), starting from the second page.
- the `instrument` text field is placed in the center of every page, starting from the second page.
- the `copyright` text is centered on the bottom of the first page.
- the `tagline` is centered on the bottom of the last page, and below the `copyright` text if there is only a single page.

The default tagline can be changed by adding a `tagline` in the top-level `\header` block.

    \book {
      \header {
        tagline = "... music notation for Everyone"
      }
      \score {
        \relative c' {
          c4 d e f
        }
      }
    }

To remove the `tagline` set the value to `##f`.

Más nyelvek: español, 日本語.

#### LilyPond — Notation Reference