On 19/01/13 19:42, Jérôme Plût wrote:
Decimo quinto Kalendas Februarias MMXIII scripsit Thomas Morley :
LilyPond supports two kinds of headers: book-header and score-header.

a) book-header (top-level!):

\header { ... }
\score { ... }

b) score-header:

\score {
   <some-music>
   \header { ... }
}
I was going to ask more or less the same question as Mark, so thanks
for the explanation. I find the whole header system extremely
confusing (for example, why must the score-header be at the *end* of
the corresponding score, this is a mystery) and would prefer
sectioning commands that work in the LaTeX way, inserting markup where
they are called instead of defining some magic values:

\title #'((title . "Concerto") (author . "Me"))

\title #'((section . "I. Allegro ma non troppo"))

\score { ... }

\title #'((section . "II. Andantino))

\score { ... }

This I can do with Scheme, but maybe something equivalent already
exists?

You can use bookparts, as in the attached example. Header fields redefined in a bookpart header override those in the overall header.

Nick
\version "2.17.6"

date = #(strftime "%d/%m/%Y" (localtime (current-time)))

\paper {
	#(define (print-positive-page-number layout props arg)
		(if (> (chain-assoc-get 'page:page-number props -1) 0)
			(create-page-number-stencil layout props arg)
			empty-stencil))

	#(define (not-last-page layout props arg)
		(if (and (chain-assoc-get 'page:is-bookpart-last-page props #f)
			(chain-assoc-get 'page:is-last-bookpart props #f))
			empty-stencil
			(interpret-markup layout props arg)))

	first-page-number = -1
	oddHeaderMarkup = \markup \fill-line { " " }
	evenHeaderMarkup = \markup \fill-line { " " }
	oddFooterMarkup = \markup \fill-line { \column { \fontsize #-1
		\on-the-fly #not-first-page \on-the-fly #not-last-page 
		\on-the-fly #print-positive-page-number \fromproperty #'page:page-number-string
		\on-the-fly #last-page \fromproperty #'header:tagline
	} }
	evenFooterMarkup = \markup \fill-line { \column { \fontsize #-1
		\on-the-fly #not-first-page \on-the-fly #not-last-page 
		\on-the-fly #print-positive-page-number \fromproperty #'page:page-number-string
		\on-the-fly #last-page \fromproperty #'header:tagline
	} }
}

\header {
	title = "Overall Title"
	subtitle = \markup { 
		\left-align \center-column {
			"Overall Subtitle"
			\lower #2 " " % to space ToC away from title/subtitle
		}
	}
	tagline = \markup {
		\fontsize #-3.5 {
			\override #'(box-padding . 1.0) \override #'(baseline-skip . 2.7) \box \center-column {
				\line {
					Engraved on \date using \with-url #"http://lilypond.org/";
					\line {
						LilyPond \simple #(lilypond-version) (http://lilypond.org/)
					}
				}
			}
		}
	}
}

\markuplist \table-of-contents
\pageBreak
\markup \null

\bookpart {
	\paper {
		print-page-number = ##t
	}
	\header { 
		title = "Piece One" % overrides overall title
		subtitle = ##f % prevent overall subtitle from appearing
		composer = "Composer One"
	} 
	\tocItem \markup { 1. Piece One }
	\relative c' { c1 }
}

\bookpart {
	\paper {
		print-page-number = ##t
	}
	\header { 
	  title = ##f % prevent overall title appearing for this piece
		subtitle = "Piece Two" % overrides overall subtitle
		composer = "Composer Two"
	}
	\tocItem \markup { 1. Piece Two }
	\relative c' { c1 }
}

\bookpart {
	\paper {
		print-page-number = ##t
	}
	\header {
		subtitle = "Piece Three" 
		composer = "Composer Three"
	}
	\tocItem \markup { 3. Piece Three }
	\relative c' { c1 }
}

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

Reply via email to