Next: , Previous: Staff notation, Up: Top


Editorial annotations

These snippets illustrate the Notation Reference, section Editorial annotations.

Adding fingerings to a score

Fingering instructions can be entered using a simple syntax.

\relative c'' {
  c4-1 d-2 f-4 e-3
}

[image of music]

Allowing fingerings to be printed inside the staff

By default, fingering numbers will be printed outside the staff. However, this behavior can be canceled.

\relative c' {
  <c-1 e-2 g-3 b-5>2
  \once \override Fingering #'staff-padding = #'()
  <c-1 e-2 g-3 b-5>2
}

[image of music]

Analysis brackets above the staff

Simple horizontal analysis brackets are added below the staff by default. The following example shows a way to place them above the staff instead.

\layout {
 \context {
   \Voice
   \consists "Horizontal_bracket_engraver"
 }
}
\relative c'' {
 \once \override HorizontalBracket #'direction = #UP
 c2\startGroup
 d\stopGroup
}

[image of music]

Applying note head styles depending on the step of the scale

The shapeNoteStyles property can be used to define various note head styles for each step of the scale (as set by the key signature or the "tonic" property). This property requires a set of symbols, which can be purely arbitrary (geometrical expressions such as triangle, cross, and xcircle are allowed) or based on old American engraving tradition (some latin note names are also allowed).

That said, to imitate old American song books, there are several predefined note head styles available through shortcut commands such as \aikenHeads or \sacredHarpHeads.

This example shows different ways to obtain shape note heads, and demonstrates the ability to transpose a melody without losing the correspondence between harmonic functions and note head styles.

fragment = {
  \key c \major
  c2 d
  e2 f
  g2 a
  b2 c
}

\score {
  \new Staff {
    \transpose c d 
    \relative c' {
      \set shapeNoteStyles = #'#(do re mi fa #f la ti)
      \fragment
    }
    
    \relative c' {
      \set shapeNoteStyles  = #'#(cross triangle fa #f mensural xcircle diamond)
      \fragment
    }
  }
}

[image of music]

Blanking staff lines using the \whiteout command

The \whiteout command underlays a markup with a white box. Since staff lines are in a lower layer than most other grobs, this white box will not overlap any other grob.

\layout { ragged-right = ##f }
\relative c' {
  \override TextScript #'extra-offset = #'(2 . 4)
  c2-\markup { \whiteout \pad-markup #0.5 "middle C" } c
} 

[image of music]

Changing a single note's size in a chord

Individual note heads in a chord can be modified with the \tweak command inside a chord, by altering the font-size property.

Inside the chord (within the brackets < >), before the note to be altered, place the \tweak command, followed by #'font-size and define the proper size like #-2 (a tiny notehead).

\layout { ragged-right = ##t }
\relative {
  <\tweak #'font-size #+2 c e g c \tweak #'font-size #-2 e>1^\markup { A tiny e }_\markup { A big c }
}

[image of music]

Changing the appearance of a slur from solid to dotted or dashed

The appearance of slurs may be changed from solid to dotted or dashed.

\relative c' {
  c4( d e c)
  \slurDotted
  c4( d e c)
  \slurSolid
  c4( d e c)
  \slurDashed
  c4( d e c)
  \slurSolid
  c4( d e c)
}

[image of music]

Controlling the placement of chord fingerings

The placement of fingering numbers can be controlled precisely.

\relative c' {
  \set fingeringOrientations = #'(left)
  <c-1 e-3 a-5>4
  \set fingeringOrientations = #'(down)
  <c-1 e-3 a-5>4
  \set fingeringOrientations = #'(right)
  <c-1 e-3 a-5>4
  \set fingeringOrientations = #'(up)
  <c-1 e-3 a-5>4
  \set fingeringOrientations = #'(left down)
  <c-1 e-3 a-5>2
  \set fingeringOrientations = #'(up right down)
  <c-1 e-3 a-5>2
}

[image of music]

Creating blank staves

To create blank staves, generate empty measures then remove the Bar_number_engraver from the Score context, and the Time_signature_engraver, Clef_engraver and Bar_engraver from the Staff context.

#(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")
  ragged-last-bottom = ##f
  line-width = 7.5\in
  left-margin = 0.5\in
  bottom-margin = 0.25\in
  top-margin = 0.25\in
}

[image of music]

Default direction of stems on the center line of the staff

The default direction of stems on the center line of the staff is set by the Stem property neutral-direction.

\relative c'' {
  a4 b c b
  \override Stem #'neutral-direction = #up
  a4 b c b
  \override Stem #'neutral-direction = #down
  a4 b c b
}

[image of music]

Embedding native PostScript in a \markup block

PostScript code can be directly inserted inside a \markup block.

% PostScript is a registered trademark of Adobe Systems Inc.

\relative c'' {
  a4-\markup { \postscript #"3 4 moveto 5 3 rlineto stroke" }
  -\markup { \postscript #"[ 0 1 ] 0 setdash 3 5 moveto 5 -3 rlineto stroke " }
  
  b4-\markup { \postscript #"3 4 moveto 0 0 1 2 8 4 20 3.5 rcurveto stroke" }
  s2
  a'1
}

[image of music]

Grid lines: changing their appearance

The appearance of grid lines can be changed by overriding some of their properties.

\layout {
 \context {
   \Staff
   % set up grids
   \consists "Grid_point_engraver"
   % set the grid interval to one quarter note
   gridInterval = #(ly:make-moment 1 4)
  }
}

\new Score \with {
 \consists "Grid_line_span_engraver"
 % this moves them to the right half a staff space
 \override NoteColumn #'X-offset = #-0.5
}

\new ChoirStaff <<
  \new Staff {
    \relative c'' {
      \stemUp
      c'4. d8 e8 f g4
    }
  }
  \new Staff {
    \relative c {
      % this moves them up one staff space from the default position
      \override Score.GridLine #'extra-offset = #'(0.0 . 1.0)
      \stemDown
      \clef bass
      \once \override Score.GridLine #'thickness = #5.0
      c4
      \once \override Score.GridLine #'thickness = #1.0
      g'
      \once \override Score.GridLine #'thickness = #3.0
      f
      \once \override Score.GridLine #'thickness = #5.0
      e
    }
  }
>>

[image of music]

Grid lines: emphasizing rhythms and notes synchronization

Regular vertical lines can be drawn between staves to show notes synchronization; however, in case of monophonic music, you may want to make the second stave invisible, and make the lines shorter like in this snippet.

%% sets of grid
\layout {
 \context {
   \Staff
   \consists "Grid_point_engraver"
   gridInterval = #(ly:make-moment 1 8)
%% lines length
   \override GridPoint #'Y-extent = #'(6 . 0)
 }
 \context {
   \StaffGroup
   \remove "System_start_delimiter_engraver"
 }
}

\layout {
 ragged-right = ##t
}
\new Score
\with {
 \consists "Grid_line_span_engraver"
%% centers grid lines  horizontally below noteheads
 \override NoteColumn #'X-offset = #-0.5
}

\new ChoirStaff <<
 \new Staff
 {
   \time 12/8
   \stemUp
   \relative {
   c'4. d8 e8 f g4 f8 e8.[ d16 c8] }
 }
 \new Staff
 {
%% making sure the lines will be placed outside the Staff
   \override Score.GridLine #'extra-offset = #'( 0.0 . -4.0 )

%% hides staff and notes so that only the grid lines are visible
   \override NoteHead #'transparent = ##t
   \override NoteHead #'no-ledgers = ##t
   \override Stem #'transparent = ##t
   \override Beam #'transparent = ##t
   \override Staff.BarLine #'transparent = ##t
   \override Staff.StaffSymbol #'line-count = #0
   \override Staff.TimeSignature #'transparent = ##t
   \override Staff.Clef #'transparent = ##t

% you have to put 'dummy' notes here to force regular grid spacing...
 \once  \override Score.GridLine #'thickness = #4.0
 c8   c8   c8
 \once  \override Score.GridLine #'thickness = #3.0
 c8   c8   c8
 \once  \override Score.GridLine #'thickness = #4.0
 c8   c8   c8
 \once  \override Score.GridLine #'thickness = #3.0
 c8   c8   c8
 }
>>

[image of music]

Making some staff lines thicker than the others

For pedagogical purposes, a staff line can be thickened (e.g., the middle line, or to emphasize the line of the G clef). This can be achieved by adding extra lines very close to the line that should be emphasized, using the line-positions property of the StaffSymbol object.

{
  \override Staff.StaffSymbol #'line-positions = #'(-4 -2 -0.2 0 0.2 2 4)
  d'4 e' f' g'
}

[image of music]

Measure counter

This snippet provides a workaround for emitting measure counters using transparent percent repeats.

<<
  \context Voice = "foo" {
    \clef bass
    c4 r g r
    c4 r g r
    c4 r g r
    c4 r g r
  }
  \context Voice = "foo" {
    \set countPercentRepeats = ##t
    \override PercentRepeat #'transparent = ##t
    \override PercentRepeatCounter #'staff-padding = #1
    \repeat percent 4 { s1 }
  }
>>

[image of music]

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

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

Your suggestions for the documentation are welcome.