Next: , Previous: Tweaks and overrides, Up: Top


Paper and layout

aligning-and-centering-instrument-names.ly

Instrument names are generally printed at the left side of the staves. To align the names of several different intruments, you can put them in a \markup block and use one of the following possibilites:

* Right-aligned instrument names: this is LilyPond's default behavior

* Center-aligned instrument names: with the \hcenter-in #n syntax, you can place the instrument names inside a padded box (n being the width of the box)

* Left-aligned instrument names: you have to print the names on top of an empty box, using the \combine command with a \hspace #n object.

\paper{ 
  indent = #0 
  left-margin = #30
  line-width = #160
}

\new StaffGroup \relative
<<
  \new Staff {
    \set Staff.instrumentName = "blabla"
    c1^"default" c1 \break 
    \set Staff.instrumentName = \markup { \hcenter-in #10 "blabla" }
    c1^"centered" c1 \break 
    \set Staff.instrumentName = \markup {\combine \hspace #8 "blabla" }
    c1^"left-aligned" c1 
    
  } 
  \new Staff {
    \set Staff.instrumentName = "blo"
    c1 c1 \break 
    \set Staff.instrumentName = \markup { \hcenter-in #10 "blo" }
    c1 c1 \break 
    \set Staff.instrumentName = \markup {\combine \hspace #8 "blo" }
    c1 c1 
  } 
  
>>

[image of music]

alignment-vertical-spacing.ly

By setting properties in NonMusicalPaperColumn, vertical spacing of alignments can be adjusted per system.

By setting alignment-extra-space or fixed-alignment-extra-space an individual system may be stretched vertically.

For technical reasons, \overrideProperty has to be used for setting properties on individual objects. \override in a \context block may still be used for global overrides.

#(set-global-staff-size 13)

\relative c''
\new StaffGroup <<
  \new Staff {
    c1\break 
    c\break 
    c\break
  }
  \new Staff { 
    c1 c c 
  }
  \new PianoStaff <<
    \new Voice  {
      \set PianoStaff.instrumentName = #"piano"
      \set PianoStaff.shortInstrumentName = #"pn"
      c1_"normal"
      
      \overrideProperty
        #"Score.NonMusicalPaperColumn"
        #'line-break-system-details
        #'((fixed-alignment-extra-space . 15))
      c_"fixed-aligment-extra-space"

      \overrideProperty
        #"Score.NonMusicalPaperColumn"
        #'line-break-system-details
        #'((alignment-extra-space . 15))
      c_"aligment-extra-space"
    }
    { c1 c c }
  >>
>>


[image of music]

changing-the-staff-size.ly

In order to change staff sizes, both staff-space and fontSize must be scaled.

{
  \new Staff \relative c'' { \dynamicDown c8 \ff c c c c c c c } 
}

{
  \new Staff \with {
    fontSize = #-3
    \override StaffSymbol #'staff-space = #(magstep -3)
  }
  {
    \clef bass
    c8 c c c  c c c c
  }
}

[image of music]

clip-systems.ly

This code shows how to clip (extracts) snippets from a full score.

This file needs to be run separately with -dclip-systems; the snippets page may not adequately show the results.

The result will be files named base-from-start-to-end[-count].eps.

#(ly:set-option 'clip-systems)

#(set! output-count 1)

origScore = \score{
    \relative {
      \set Staff.instrumentName = #"bla"
      c1
      d
      \grace c16
      e1
      \key d\major
      
      f
      \break  \clef bass
      g,
      fis
    }  
}

\book { 
  \score {
    \origScore
    \layout {

      %% each clip-region is a (START . END) pair
      %% where both are rhythmic-locations.
      
      %% (make-rhythmic-locations BAR-NUMBER NUM DEN)
      %% means NUM/DEN whole-notes into bar numbered BAR-NUMBER

      clip-regions
      = #(list
	  (cons
	   (make-rhythmic-location 2 0 1)
	   (make-rhythmic-location 4 0 1))

	  (cons
	   (make-rhythmic-location 0 0 1)
	   (make-rhythmic-location 4 0 1))
	  
	  (cons
	   (make-rhythmic-location 0 0 1)
	   (make-rhythmic-location 6 0 1))
	)
    }
  }
}

#(set! output-count 0)
#(ly:set-option 'clip-systems #f)

\book {
  \score { \origScore }
  \markup { \bold \fontsize #6 clips }
  \score {
    \lyrics {
      \markup { from-2.0.1-to-4.0.1-clip.eps }
      \markup { \epsfile #X #30.0 #(format #f "~a-1-from-2.0.1-to-4.0.1-clip.eps" (ly:parser-output-name parser)) }
    }
  }
}

[image of music]

creating-blank-staves.ly

To create blank staves, you must generate empty measures, removing also from the Score context the Bar_number_engraver, and from the Staff context the Time_signature_engraver, the Clef_engraver and the Bar_engraver.

#(set-global-staff-size 20)

\score {
  { 
    \repeat unfold 12 { s1 \break } 
  }
  \layout {
    indent = 0\in
    \context {
      \Staff
      \remove Time_signature_engraver
      \remove Clef_engraver
      \remove Bar_engraver
    }
    \context {
      \Score
      \remove Bar_number_engraver
    }
  }
}

\paper {
  #(set-paper-size "letter")
  raggedlastbottom = ##f
  linewidth = 7.5\in
  leftmargin = 0.5\in
  bottommargin = 0.25\in
  topmargin = 0.25\in
}

[image of music]

demonstrating-all-headers.ly

All header fields with special meanings.


[image of music]

table-of-contents.ly

A table of contents is included using \markuplines \table-of-contents. The TOC items are added with the \tocItem command.

#(set-default-paper-size "a6")

\book {
  \markuplines \table-of-contents
  \pageBreak

  \tocItem \markup "The first score"
  \score {
    { 
      c'1 \pageBreak
      \mark "A" \tocItem \markup "Mark A"
      d'
    }
  }
  \pageBreak
  \tocItem \markup "The second score"
  \score {
    { e' }
    \header { piece = "Second score" }
  }
}

[image of music]



Next: , Previous: Tweaks and overrides, Up: Top

This page is for LilyPond-2.11.40 (development-branch).

Report errors to http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs.

Your suggestions for the documentation are welcome.