Next: , Previous: Balloon help, Up: Outside the staff


Grid lines

Vertical lines can be drawn between staves synchronized with the notes.

The Grid_point_engraver must be used to create the end points of the lines, while the Grid_line_span_engraver must be used to actually draw the lines. By default this centers grid lines horizontally below and to the left side of each note head. Grid lines extend from the middle lines of each staff. The gridInterval must specify the duration between the grid lines.

     
     \layout {
       \context {
         \Staff
         \consists "Grid_point_engraver" 
         gridInterval = #(ly:make-moment 1 4)
       }
       \context {
         \Score
         \consists "Grid_line_span_engraver"
       }
     }
     
     \score {
       \new ChoirStaff <<
         \new Staff \relative c'' {
           \stemUp
           c4. d8 e8 f g4
         }
         \new Staff \relative c {
           \clef bass
           \stemDown
           c4 g' f e
         }
       >>
     }

[image of music]

Selected Snippets

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]

See also

Snippets: Editorial annotations.

Internals Reference: Grid_line_span_engraver, Grid_point_engraver, GridLine, GridPoint, grid-line-interface, grid-point-interface.

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.

Other languages: français, español.