This document shows examples from the LilyPond Snippet Repository.
In the web version of this document, you can click on the file name or figure for each example to see the corresponding input file.
You can add (possibly temporarily) an extra staff after the beginning of a piece.
Instrument names can be displayed using a \markup command; in this case the name is placed inside a padded box, which can help vertical alignment.
changing-the-number-of-lines-in-a-staff.ly
The number of lines in a staff may changed by overriding
line-count
in the properties of StaffSymbol
.
In order to change staff sizes, both staff-space
and
fontSize
must be scaled.
displaying-bar-numbers-on-all-measures.ly
By default, bar numbers are printed only in the first measure. This setting can be overridden, so that bar numbers appear on start of every measure.
how-to-add-text-marks-at-the-end-of-a-line.ly
By default, rehearsal marks specified at the end of a line are printed at the beginning of the next line (even if it is the end of the piece, in such case the mark isn't printed at all).
To avoid this, override the #'break-visibility property of the RehearsalMark object, like in the following snippet.
inserting-bar-lines-everywhere.ly
By setting barAlways
and defaultBarType
, barlines may be
inserted automatically everywhere.
inserting-score-fragments-above-the-staff,-as-markups.ly
The \markup command is quite versatile. In this snippet, it contains a \score bloc instead of texts or marks.
making-bar-numbers-appear-at-regular-intervals.ly
If you would like the bar numbers to appear at regular intervals, but
not starting from measure zero, you can use a context function,
set-bar-number-visibility
, to set automatically
barNumberVisibility
, so that the bar numbers appear at regular
intervals, starting from the measure in which
set-bar-number-visibility
is set using \applycontext
.
You can have a name for the whole GrandStaff
in addition to
individual Staff
s.
removing-the-key-signature-at-the-end-of-a-line.ly
According to normal typesetting conventions, LilyPond typesets key changes at the end of the line, when the change appears at a line break. This example shows how to change this default to only print the new key signature at the beginning of the next line.
Staffs can be nested in various combinations. Here, StaffGroup
and ChoirStaff
produce similar straight brackets, whereas
GrandStaff
produces curly brackets. In InnerStaffGroup
and InnerChoirStaff
, the brackets are shifted leftwards.
In this preliminary test of a modern score, the staff lines are washed
out temporarily. This is done by making a tuned StaffContainer
,
which \skip
s some notes without printing lines either and
creates a
ew Staff
then in order to create the lines again.
(Be careful if you use this; it has been done by splitting the grouping
Axis_group_engraver
and creating functionality into separate
contexts, but the clefs and time signatures may not do what you would
expect.)
The vertical positions of staff lines may be specified individually, by
setting the line-positions
property of the StaffSymbol.
This page is for LilyPond-2.11.28 (development-branch).
Report errors to http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs.
Your suggestions for the documentation are welcome.