[ << General input and output ] | [Top][Contents][Index] | [ Spacing issues >> ] |
[ < Custom layout for titles ] | [ Up : Custom titles, headers, and footers ] | [ Creating output file metadata > ] |
Custom layout for headers and footers
\markup
commands in the \header
block are useful for
simple text formatting, but they do not allow precise control over the
placement of headers and footers. To customize the placement of
the text fields, use one or more of the following \paper
variables.
-
oddHeaderMarkup
-
evenHeaderMarkup
-
oddFooterMarkup
-
evenFooterMarkup
The \markup
command \if
can be used to add markup
conditionally to header and footer text defined within the
\paper
block, using the following syntax within
\markup
:
\if condition argument
The condition is tested each time the markup is interpreted. The
resulting markup is argument if the condition is true, but empty if false.
Typical conditions include tests for page numbers (first page, last page,
specific page, …). To test for the condition being false, replace
\if
with \unless
.
The following example centers page numbers at the bottom of every
page. First, the default settings for oddHeaderMarkup
and
evenHeaderMarkup
are removed by assigning #f
.
Then, oddFooterMarkup
is redefined with the page
number centered. Finally, evenFooterMarkup
is given the
same layout by defining it as \oddFooterMarkup
:
\book { \paper { print-page-number = ##t print-first-page-number = ##t oddHeaderMarkup = ##f evenHeaderMarkup = ##f oddFooterMarkup = \markup { \fill-line { \if \should-print-page-number \fromproperty #'page:page-number-string } } evenFooterMarkup = \oddFooterMarkup } \score { \new Staff { s1 \break s1 \break s1 } } }
Here is a list of all predefined procedures available for use with
\if
and \unless
.
Syntax Condition tested \on-first-page
First page in the book? \on-last-page
Last page in the book? \on-first-page-of-part
First page in the book part? \on-last-page-of-part
Last page in the book part? \on-page n
On page number n? \single-page
Does the book fit on just one page? \should-print-page-numbers-global
Print page numbers in the book? 7 \should-print-page-number
Print the number of the current page? \should-print-all-headers
Is print-all-headers
true?
See also
Notation Reference: Titles explained, Default layout of bookpart and score titles, Conditional markup.
Installed Files: ../ly/titling-init.ly.
Footnotes
(7)
\should-print-page-numbers-global
can differ from
\should-print-page-number
for the first page in the book,
depending on the print-first-page-number
setting of the
\paper
block.
[ << General input and output ] | [Top][Contents][Index] | [ Spacing issues >> ] |
[ < Custom layout for titles ] | [ Up : Custom titles, headers, and footers ] | [ Creating output file metadata > ] |