lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Instrument name in top line


From: David Kastrup
Subject: Re: Instrument name in top line
Date: Sat, 09 Jun 2012 09:26:03 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

Helge Kruse <address@hidden> writes:

> When you add the "instrument" to the header block, it is printed below
> the title at the first page. It is also printed in each top line of
> subsequent pages.
>
> But when you start a new bookpart the instrument name is printed on
> the first page too. This looks a bit ugly. How can I avoid this
> duplication? I would like to skip the instrument name in the top line
> at the first page of the bookpart.
>
> Helge
>
> \version "2.15.38"
>
> melody = \relative c'' { \repeat unfold 100 { c4 d e f g f e d } }
> \header { title="My Song" }
> \book {
>   \bookpart {
>     \header { instrument = "Flute" }
>     \new Staff { \melody }
>   }
>   \bookpart {
>     \header { instrument = "Oboe" }
>     \new Staff { \melody }
>   }
> }

It's a larger copy&paste job:

\version "2.15.38"

% copy, paste & modify from ly/titling-init.ly

\paper {
%% Bookpart first page and last page predicates
#(define (not-part-first-page layout props arg)
  (if (= (chain-assoc-get 'page:page-number props -1)
         (ly:output-def-lookup layout 'first-page-number))
      empty-stencil
      (interpret-markup layout props arg)))

oddHeaderMarkup = \markup
\fill-line {
  %% force the header to take some space, otherwise the
  %% page layout becomes a complete mess.
  " "
  \on-the-fly #not-part-first-page \fromproperty #'header:instrument
  \on-the-fly #print-page-number-check-first \fromproperty 
#'page:page-number-string
}

%% evenHeaderMarkup would inherit the value of
%% oddHeaderMarkup if it were not defined here
evenHeaderMarkup = \markup
\fill-line {
  \on-the-fly #print-page-number-check-first \fromproperty 
#'page:page-number-string
  \on-the-fly #not-part-first-page \fromproperty #'header:instrument
  " "
}

} % \paper

melody = \relative c'' { \repeat unfold 100 { c4 d e f g f e d } }
\header { title="My Song" }
\book {
  \bookpart {
    \header { instrument = "Flute" }
    \new Staff { \melody }
  }
  \bookpart {
    \header { instrument = "Oboe" }
    \new Staff { \melody }
  }
}


-- 
David Kastrup




reply via email to

[Prev in Thread] Current Thread [Next in Thread]