Next: , Previous: Titles, Up: Top


Spacing

adjusting-lyrics-vertical-spacing.ly

This snippets shows you how to bring the lyrics line closer to the Staff.

% Default layout:
\score{
  <<
    \new Staff \new Voice = m \relative c'{ c4 d e f g f e d c1}
    \new Lyrics \lyricsto m {aa aa aa aa aa aa aa aa aa }
  >>
}

% Reducing the minimum space below the Staff and above the Lyrics:

\score {
  <<
    \new Staff \with {
      \override VerticalAxisGroup #'minimum-Y-extent = #'(-1. 4)}
    \new Voice = m \relative c'{ c4 d e f g f e d c1 }
    \new Lyrics \with {
      \override VerticalAxisGroup #'minimum-Y-extent = #'(-1.2 . 1)}
    \lyricsto m {aa aa aa aa aa aa aa aa aa }
  >>

  \header {
    tagline = ""
  }
}

[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]

page-label.ly

Page labels may be placed inside music or at top-level, and refered to in markups.

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

#(define-markup-command (toc-line layout props label text) (symbol? markup?)
  (interpret-markup layout props
   (markup #:fill-line (text #:page-ref label "8" "?"))))

\book {
  \markup \huge \fill-line { \null "Title Page" \null }

  \pageBreak

  \label #'toc
  \markup \column {
    \large \fill-line { \null "Table of contents" \null }
    \toc-line #'toc "Table of contents"
    \toc-line #'firstScore "First Score"
    \toc-line #'markA "Mark A"
    \toc-line #'markB "Mark B"
    \toc-line #'markC "Mark C"
    \toc-line #'unknown "Unknown label"
  }

  \pageBreak

  \label #'firstScore
  \score {
    { c'2 c'
      \mark \markup { A (page \concat { \page-ref #'markA "0" "?" ) }} \label #'markA 
      c' c'
      \pageBreak
      \mark "B" \label #'markB
      d' d'
      d' d'
      \once \override Score . RehearsalMark #'break-visibility = #begin-of-line-invisible
      \mark "C" \label #'markC
    }
    \header { piece = "First score" }
  }
}

[image of music]

proportional-strict-notespacing.ly

If strict-note-spacing is set spacing of notes is not influenced by bars or clefs part way along the system. Rather, they are put just before the note that occurs at the same time. This may cause collisions.

\paper {
  ragged-right = ##t
  indent = 0
}
\layout {
  \context {
    \Score
  }
}

\relative c'' <<
  \override Score.SpacingSpanner #'strict-note-spacing = ##t 
  \set Score.proportionalNotationDuration = #(ly:make-moment 1 16)
  \new Staff {
    c8[ c \clef alto c c \grace { d16 }  c8 c]  c4 c2
    \grace { c16[ c16] }
    c2 }
  \new Staff {
    c2  \times 2/3 { c8 \clef bass cis,, c } 
    c4
    c1
  }
>>

[image of music]

vertically-aligning-ossias-and-lyrics.ly

This snippet shows of to use the alignBelowContext and alignAboveContext properties, which may be needed for text elements (e.g. lyrics) positioning, but also for musical contents such as ossias.

\paper {
  ragged-right = ##t
}

\relative <<
  \new Staff = "1" { c4 c s2 }
  \new Staff = "2" { c4  c s2 }
  \new Staff = "3" { c4  c s2 }
  { \skip 2
    <<
      \lyrics {
	\set alignBelowContext = #"1"
	below8 first staff
      }
      \new Staff {
	\set Staff.alignAboveContext = #"3"
	\times 4/6 {
	  \override TextScript #'padding = #3
	  c8^"this" d_"staff" e^"above" d_"last" e^"staff" f
	}
      }
    >> }
>>

[image of music]

vertically-centered-dynamics-and-textscripts.ly

By setting the Y-extent property to a fixed value (here -1.5 . 1.5), we force LilyPond to align every elements of the DynamicLineSpanner (text elements and dynamics) to a common reference point, regardless to the actual extent of these objects. This way, every element will be vertically centered, for a nicer output (you can compare the first and the second line in this example; the trick is only applied on the second line).

The same idea is used to align the text scripts along their baseline.

\paper { indent = 0 line-width = 5\in }

music = \relative c''
{
   c2\p^\markup { "gorgeous" } c\f^\markup { "fantastic" }
   c4\p c \f \> c c \! \p
}

\score
{
   {
       \music \break

       \override DynamicLineSpanner #'staff-padding = #2.0
       \override DynamicLineSpanner #'Y-extent = #'(-1.5 . 1.5)
       \override TextScript #'Y-extent = #'(-1.5 . 1.5)
       \music
   }
}

[image of music]



Next: , Previous: Titles, 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.