This document shows all kinds of tips and tricks, from simple to advanced. You may also find dirty tricks, or the very very latest features that have not been documented or fully implemented yet.
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.
This document is for LilyPond version 2.10.33.
Using make-music
, you can add various stuff to notes. In this
example staccato dots are added to the notes.
You can add various stuff to notes using make-music
.
In this example, an extra fingering is attached to a note.
Ambits can be added per voice. In that case, the ambitus must be moved manually to prevent collisions.
Accidentals are available in different ancient styles, which all are collected here.
Here are shown many (all?) of the symbols that are included in LilyPond's support of ancient notation.
Time signatures may also be engraved in an old style.
By setting barAlways
and defaultBarType
, barlines may be inserted automatically everywhere.
You can move Bar_engraver
and Span_bar_engraver
to
a different engraving context, if you want, for example, bar lines
on lyrics.
bar-number-every-five-reset.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
.
By default, bar numbers are printed only in the first measure. This setting can be overridden, so that bar numbers on start of every measure.
The eighth notes may be seemingly attached to different beams, and the corresponding notes connected by ties (see also tie-cross-voice.ly). Such a situation may occur, for example, in the cello suites.
You can override the automatic beaming settings.
The auto-beamer, which can be overridden, will only engrave beams that end before encountering of
The autoBeaming
can also be turned off.
Beam positions may be controlled manually, by overriding the positions
setting of the Beam
grob.
You can alter the number of stems in a beam. In this example, two sets of four 32nds are joined, as if they were 8th notes.
The print-function
can be overridden to draw a box around an arbitrary
grob.
The font can be changed to small caps.
Circles can be drawn around various objects.
Compound time signatures can be printed. Automatic beaming works in compound time.
In an orchestral score (Beethoven's Coriolan overture), there are different instrument groups, and some of the instruments may be transposed. Instruments are indicated either with a long or short name.
Più forte dynamics is produced using \markup
.
The markup command \postscript
inserts postscript directly into
the output.
In polyphonic notation, many voices can share a staff: In this situation, the accidentals and staff are shared, but the stems, slurs, beams, etc. are private to each voice. Hence, engravers should be grouped. The engravers for note head, stems, slurs, etc. go into a group called “Voice context”, while the engravers for key, accidental, bar, etc. go into a group called “Staff context”. In the case of polyphony, a single Staff context contains more than one Voice context. Similarly, more Staff contexts can be put into a single Score context.
The notation problem, creating a certain symbol, is handled by plugins. Each plugin is called Engraver. In this example, engravers are switched on one by one, in the following order:
Engravers are grouped. For example, note heads, slurs, beams etc. form a Voice context. Engravers for key, accidental, bar, etc. form a Staff context.
You can add (possibly temporarily) an extra staff after the beginning of a piece.
Frets are supported as markup commands.
Here is demonstrated a preliminary support of Gregorian Scripts:
ictus, circulus, semicirculus, accentus, episem.
High level functionality (eg. conditional defines), can be accomplished with GUILE.
This example puts the current version in the title via Scheme.
You can combine two parts on the same staff using the part combiner. For vocal scores (hymns), there is no need to add solo/a2 texts, so they should be switched off.
instrument names may be aligned manually by putting the
names in padded boxes with \markup
.
You can have a name for the whole GrandStaff
in addition to
individual Staff
s.
Vaticana ligature uses four staff lines, special clef, and calligraphic notes. Augmentum dots are collected behind ligatures.
All header fields with special meanings.
In mensural ligatures, notes with ancient durations are printed in a tight manner.
Mensural notes may also have note heads.
Objects, like text, can be moved around by using some Scheme code.
This example shows prelude in C major of WTK1, but coded using Scheme functions to avoid typing work.
You can engrave music using just Scheme expressions. Although those expressions reflect the inner mechanism of LilyPond, they are rather clumsy to use, so avoid them, if possible.
Engravers can be removed one by one. Here, the time signature and bar lines have been removed.
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.
When entering partially typeset music (i.e. for students to be completed by hand), you may need the spacing that correspond to the timing of notes: all measures have same length, etc. It can be implemented by adding an invisible staff with a lot of fast notes.
The object may be extended to larger sized by overriding their properties.
The lyrics in this example have an extent of (-10,10)
, which is why
they are spaced so widely.
Rests may be used in various styles.
Symmetric, or palindromical music can be produced, first, by printing some music, and second, by printing the same music applying a Scheme function to reverse the syntax.
In extreme cases, you can resort to setting the
control-points
of a slur manually, althout it involves
a lot of trial and error. Be sure to force line breaks at both sides, since
different horizontal spacing will require rearrangement of the
slur.
By setting the minimum length of a slur, notes are more separated.
There is a way to enforce enharmonic modifications for notes in order to have the minimum number of accidentals. In that case, “Double accidentals should be removed, as well as E-sharp (-> F), bC (-> B), bF (-> E), B-sharp (-> C).”, as proposed by a request for a new feature. In this manner, the most natural enharmonic notes are chosen in this example.
Stem directions and head positions are taken into account for spacing
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 \new 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 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.
Extending stems to the center line may be prevented using no-stem-extend
.
A hammer in tablature can be faked with slurs.
An additional stave can be typeset in the middle of a score line. A new context type is created for the temporary staff to avoid printing time and key signatures and clef at the beginning of the extra stave.
Text spanners can be used in the similar manner than markings for pedals or octavation.
Time signatures may be put on a separate staff. This is used contemporary pieces with many time signature changes.
By putting the output of
lilypond-version
into a lyric, it is possible to print the
version number of LilyPond in a score, or in a document generated
with lilypond-book
. Another possibility is to append the
version number to the doc-string, in this manner: 2.10.33
Vertical extents may increased by setting \override VerticalAxisGroup #'minimum-Y-extent
,
extra-Y-extent
, and Y-extent
. In this example,
Y-extent
is increased.
Volta brackets can be placed over chord names. Just set
the voltaOnThisStaff
property to true for the ChordNames
context and to false for the topmost ordinary Staff
context.
This page is for LilyPond-2.10.33 (stable-branch).