1.7.1 Inside the staff

This section discusses how to add emphasis to elements that are inside the staff.


Selecting notation font size

The font size of notation elements may be altered. It does not change the size of variable symbols, such as beams or slurs.

Note: For font sizes of text, see Selecting font and font size.

\huge
c4.-> d8---3
\large
c4.-> d8---3
\normalsize
c4.-> d8---3
\small
c4.-> d8---3
\tiny
c4.-> d8---3
\teeny
c4.-> d8---3

[image of music]

Internally, this sets the fontSize property. This in turn causes the font-size property to be set in all layout objects. The value of font-size is a number indicating the size relative to the standard size for the current staff height. Each step up is an increase of approximately 12% of the font size. Six steps is exactly a factor of two. The Scheme function magstep converts a font-size number to a scaling factor. The font-size property can also be set directly, so that only certain layout objects are affected.

\set fontSize = #3
c4.-> d8---3
\override NoteHead #'font-size = #-4
c4.-> d8---3
\override Script #'font-size = #2
c4.-> d8---3
\override Stem #'font-size = #-5
c4.-> d8---3

[image of music]

Font size changes are achieved by scaling the design size that is closest to the desired size. The standard font size (for font-size = #0) depends on the standard staff height. For a 20pt staff, a 10pt font is selected.

The font-size property can only be set on layout objects that use fonts. These are the ones supporting the font-interface layout interface.

Predefined commands

\teeny, \tiny, \small, \normalsize, \large, \huge.

See also

Snippets: Editorial annotations.

Internals Reference: font-interface.


Fingering instructions

Fingering instructions can be entered using ‘note-digit’:

c4-1 d-2 f-4 e-3

[image of music]

Markup texts may be used for finger changes.

c4-1 d-2 f-4 c^\markup { \finger "2 - 3" }

[image of music]

A thumb-script can be added (e.g. cello music) to indicate that a note should be played with the thumb.

<a_\thumb a'-3>2 <b_\thumb b'-3>

[image of music]

Fingerings for chords can also be added to individual notes by adding them after the pitches.

<c-1 e-2 g-3 b-5>2 <d-1 f-2 a-3 c-5>

[image of music]

Fingering instructions may be manually placed above or below the staff, see Direction and placement.

Selected Snippets

Controlling the placement of chord fingerings

The placement of fingering numbers can be controlled precisely. For fingering orientation to apply, you must use a chord construct <> even if it is a single note.

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

[image of music]

Allowing fingerings to be printed inside the staff

By default, vertically oriented fingerings are positioned outside the staff. However, this behavior can be canceled. Note: you must use a chord construct <>, even if it is only a single note.

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

[image of music]

Avoiding collisions with chord fingerings

Fingerings and string numbers applied to individual notes will automatically avoid beams and stems, but this is not true by default for fingerings and string numbers applied to the individual notes of chords. The following example shows how this default behavior can be overridden.

\relative c' {
  \set fingeringOrientations = #'(up)
  \set stringNumberOrientations = #'(up)
  \set strokeFingerOrientations = #'(up)

  % Default behavior
  r8
  <f c'-5>8
  <f c'\5>8
  <f c'-\rightHandFinger #2 >8

  % Corrected to avoid collisions
  r8
  \override Fingering #'add-stem-support = ##t
  <f c'-5>8
  \override StringNumber #'add-stem-support = ##t
  <f c'\5>8
  \override StrokeFinger #'add-stem-support = ##t
  <f c'-\rightHandFinger #2 >8
}

[image of music]

See also

Notation Reference: Direction and placement.

Snippets: Editorial annotations.

Internals Reference: FingeringEvent, fingering-event, Fingering_engraver, New_fingering_engraver, Fingering.

Known issues and warnings

By default, numbers greater than 9 are not supported using ‘note-digit’.


Hidden notes

Hidden (or invisible or transparent) notes can be useful in preparing theory or composition exercises.

c4 d
\hideNotes
e4 f
\unHideNotes
g a
\hideNotes
b
\unHideNotes
c

[image of music]

Note heads, stems, and flags, and rests are invisible. Beams are invisible if they start on a hidden note. Objects that are attached to invisible notes are still visible.

e8(\p f g a)--
\hideNotes
e8(\p f g a)--

[image of music]

Predefined commands

\hideNotes, \unHideNotes.

See also

Learning Manual: Visibility and color of objects.

Notation Reference: Invisible rests, Visibility of objects, Hiding staves.

Snippets: Editorial annotations.

Internals Reference: Note_spacing_engraver, NoteSpacing.


Coloring objects

Individual objects may be assigned colors. Valid color names are listed in the List of colors.

\override NoteHead #'color = #red
c4 c
\override NoteHead #'color = #(x11-color 'LimeGreen)
d
\override Stem #'color = #blue
e

[image of music]

The full range of colors defined for X11 can be accessed by using the Scheme function x11-color. The function takes one argument; this can be a symbol in the form 'FooBar or a string in the form "FooBar". The first form is quicker to write and is more efficient. However, using the second form it is possible to access X11 colors by the multi-word form of its name.

If x11-color cannot make sense of the parameter then the color returned defaults to black.

\override Staff.StaffSymbol #'color = #(x11-color 'SlateBlue2)
\set Staff.instrumentName = \markup {
  \with-color #(x11-color 'navy) "Clarinet"
}

gis8 a
\override Beam #'color = #(x11-color "medium turquoise")
gis a
\override Accidental #'color = #(x11-color 'DarkRed)
gis a
\override NoteHead #'color = #(x11-color "LimeGreen")
gis a
% this is deliberate nonsense; note that the stems remain black
\override Stem #'color = #(x11-color 'Boggle)
b2 cis

[image of music]

Exact RGB colors can be specified using the Scheme function rgb-color.

\override Staff.StaffSymbol #'color = #(x11-color 'SlateBlue2)
\set Staff.instrumentName = \markup {
  \with-color #(x11-color 'navy) "Clarinet"
}

\override Stem #'color = #(rgb-color 0 0 0)
gis8 a
\override Stem #'color = #(rgb-color 1 1 1)
gis8 a
\override Stem #'color = #(rgb-color 0 0 0.5)
gis4 a

[image of music]

See also

Notation Reference: List of colors, The \tweak command.

Snippets: Editorial annotations.

Known issues and warnings

An X11 color is not necessarily exactly the same shade as a similarly named normal color.

Not all X11 colors are distinguishable in a web browser, i.e., a web browser might not display a difference between LimeGreen and ForestGreen. For web use normal colors are recommended (i.e., blue, green, red).

Notes in a chord cannot be colored with \override; use \tweak instead, see The \tweak command.


Parentheses

Objects may be parenthesized by prefixing \parenthesize to the music event. When prefixed to a chord, it parenthesizes every note. Individual notes inside a chord may also be parenthesized.

c2 \parenthesize d
c2 \parenthesize <c e g>
c2 <c \parenthesize e g>

[image of music]

Non-note objects may be parenthesized as well. For articulations, a hyphen is needed before the \parenthesize command.

c2-\parenthesize -. d
c2 \parenthesize r

[image of music]

See also

Snippets: Editorial annotations.

Internals Reference: Parenthesis_engraver, ParenthesesItem, parentheses-interface.

Known issues and warnings

Parenthesizing a chord prints parentheses around each individual note, instead of a single large parenthesis around the entire chord.


Stems

Whenever a note is found, a Stem object is created automatically. For whole notes and rests, they are also created but made invisible.

Stems may be manually placed to point up or down; see Direction and placement.

Predefined commands

\stemUp, \stemDown, \stemNeutral.

Selected Snippets

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]

See also

Notation Reference: Direction and placement.

Snippets: Editorial annotations.

Internals Reference: Stem_engraver, Stem, stem-interface.


Other languages: deutsch, español, français, italiano, 日本語.
About automatic language selection.

LilyPond — Notation Reference