Helge Kruse <helge.kruse-nos...@gmx.net> 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


_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to