[ << Contexts and engravers ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Top ] | [ > ] |
Tweaks and overrides
These snippets illustrate the Notation Reference, section Changing defaults.
See also Learning Manual, section Tweaking output.
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < Tweaks and overrides ] | [ Up : Tweaks and overrides ] | [ > ] |
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 d2\stopGroup }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
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 }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Caesura ("railtracks") with fermata
A caesura is sometimes denoted by a double "railtracks" breath mark with a fermata sign positioned above. This snippet should present an optically pleasing combination of railtracks and fermata.
\relative c'' { c2. % construct the symbol \override BreathingSign #'text = \markup { \line { \musicglyph #"scripts.caesura.curved" \translate #'(-1.75 . 1.6) \musicglyph #"scripts.ufermata" } } \breathe c4 % set the breathe mark back to normal \revert BreathingSign #'text c2. \breathe c4 \bar "|." }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
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 } }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Changing form of multi-measure rests
If there are ten or fewer measures of rests, a series of longa
and breve rests (called in German "Kirchenpausen" - church rests)
is printed within the staff; otherwise a simple line is shown.
This default number of ten may be changed by overriding the
expand-limit
property:
\relative c'' { \compressFullBarRests R1*2 | R1*5 | R1*9 \override MultiMeasureRest #'expand-limit = #3 R1*2 | R1*5 | R1*9 }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Changing properties for individual grobs
The \applyOutput
command allows the tuning of any layout
object, in any context. It requires a Scheme function with three
arguments.
#(define (mc-squared grob grob-origin context) (let* ( (ifs (ly:grob-interfaces grob)) (sp (ly:grob-property grob 'staff-position)) ) (if (memq 'note-head-interface ifs) (begin (ly:grob-set-property! grob 'stencil (grob-interpret-markup grob (make-lower-markup 0.5 (case sp ((-5) "m") ((-3) "c ") ((-2) (make-smaller-markup (make-bold-markup "2"))) (else "bla") )))) )))) \relative c' { <d f g b>2 \applyOutput #'Voice #mc-squared <d f g b>2 }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Changing text and spanner styles for text dynamics
The text used for crescendos and decrescendos can be changed by
modifying the context properties crescendoText
and
decrescendoText
. The style of the spanner line can be
changed by modifying the 'style
property of
DynamicTextSpanner
. The default value is 'hairpin
,
and other possible values include 'line
, 'dashed-line
and 'dotted-line
:
\relative c'' { \set crescendoText = \markup { \italic { cresc. poco } } \set crescendoSpanner = #'text \override DynamicTextSpanner #'style = #'dotted-line a2\< a a2 a a2 a a2 a\mf }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Changing the default text font family
The default font families for text can be overridden with
make-pango-font-tree
.
\paper { % change for other default global staff size. myStaffSize = #20 %{ run lilypond -dshow-available-fonts blabla to show all fonts available in the process log. %} #(define fonts (make-pango-font-tree "Times New Roman" "Nimbus Sans" "Luxi Mono" ;; "Helvetica" ;; "Courier" (/ myStaffSize 20))) } \relative c'' { c4^\markup { roman: foo \bold bla \italic bar \italic \bold baz } c'4_\markup { \override #'(font-family . sans) { sans: foo \bold bla \italic bar \italic \bold baz } } c'2^\markup { \override #'(font-family . typewriter) { mono: foo \bold bla \italic bar \italic \bold baz } } }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Changing the staff size
Though the simplest way to resize staves is to use
#(set-global-staff-size xx)
, an individual staff’s size can be
changed by scaling the properties 'staff-space
and
fontSize
.
<< \new Staff { \relative c'' { \dynamicDown c8\ff c c c c c c c } } \new Staff \with { fontSize = #-3 \override StaffSymbol #'staff-space = #(magstep -3) } { \clef bass c8 c c c c\f c c c } >>
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Controlling the vertical ordering of scripts
The vertical ordering of scripts is controlled with the
'script-priority
property. The lower this number, the closer it
will be put to the note. In this example, the TextScript
(the
sharp symbol) first has the lowest priority, so it is put lowest in the
first example. In the second, the prall trill (the Script
) has
the lowest, so it is on the inside. When two objects have the same
priority, the order in which they are entered determines which one
comes first.
\relative c''' { \once \override TextScript #'script-priority = #-100 a2^\prall^\markup { \sharp } \once \override Script #'script-priority = #-100 a2^\prall^\markup { \sharp } }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Controlling tuplet bracket visibility
The default behavior of tuplet-bracket visibility is to print a bracket
unless there is a beam of the same length as the tuplet. To control the
visibility of tuplet brackets, set the property
'bracket-visibility
to either #t
(always print a
bracket), #f
(never print a bracket) or #'if-no-beam
(only print a bracket if there is no beam).
music = \relative c'' { \times 2/3 { c16[ d e } f8] \times 2/3 { c8 d e } \times 2/3 { c4 d e } } \new Voice { \relative c' { << \music s4^"default" >> \override TupletBracket #'bracket-visibility = #'if-no-beam << \music s4^"'if-no-beam" >> \override TupletBracket #'bracket-visibility = ##t << \music s4^"#t" >> \override TupletBracket #'bracket-visibility = ##f << \music s4^"#f" >> } }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Creating a delayed turn
Creating a delayed turn, where the lower note of the
turn uses the accidental, requires several overrides. The
outside-staff-priority
property must be set to #f
,
as otherwise this would take precedence over the
avoid-slur property
. The value of halign
is used
to position the turn horizontally.
\relative c'' { \once \override TextScript #'avoid-slur = #'inside \once \override TextScript #'outside-staff-priority = ##f c2(^\markup \tiny \override #'(baseline-skip . 1) { \halign #-4 \center-column { \sharp \musicglyph #"scripts.turn" } } d4.) c8 }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Creating simultaneous rehearsal marks
Unlike text scripts, rehearsal marks cannot be stacked at a particular point
in a score: only one RehearsalMark
object is created. Using an
invisible measure and bar line, an extra rehearsal mark can be added, giving
the appearance of two marks in the same column.
This method may also prove useful for placing rehearsal marks at both the end of one system and the start of the following system.
{ \key a \major \set Score.markFormatter = #format-mark-box-letters \once \override Score.RehearsalMark #'outside-staff-priority = #5000 \once \override Score.RehearsalMark #'self-alignment-X = #LEFT \once \override Score.RehearsalMark #'break-align-symbols = #'(key-signature) \mark \markup { \bold { Senza denti } } % the hidden measure and bar line \once \override Score.TimeSignature #'stencil = ##f \time 1/16 s16 \bar "" \time 4/4 \once \override Score.RehearsalMark #'self-alignment-X = #LEFT \once \override Score.RehearsalMark #'break-align-symbols = #'(bar-line) \mark \markup { \box \bold Intro } d'1 \mark \default d'1 }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Creating text spanners
The \startTextSpan
and \stopTextSpan
commands allow the creation of text spanners as easily as pedal
indications or octavations. Override some properties of the
TextSpanner
object to modify its output.
\paper { ragged-right = ##f } \relative c'' { \override TextSpanner #'(bound-details left text) = #"bla" \override TextSpanner #'(bound-details right text) = #"blu" a4 \startTextSpan b4 c a4 \stopTextSpan \override TextSpanner #'style = #'line \once \override TextSpanner #'(bound-details left stencil-align-dir-y) = #CENTER a4 \startTextSpan b4 c a4 \stopTextSpan \override TextSpanner #'style = #'dashed-line \override TextSpanner #'(bound-details left text) = \markup { \draw-line #'(0 . 1) } \override TextSpanner #'(bound-details right text) = \markup { \draw-line #'(0 . -2) } \once \override TextSpanner #'(bound-details right padding) = #-2 a4 \startTextSpan b4 c a4 \stopTextSpan \set Staff.middleCPosition = #-13 \override TextSpanner #'dash-period = #10 \override TextSpanner #'dash-fraction = #0.5 \override TextSpanner #'thickness = #10 a4 \startTextSpan b4 c a4 \stopTextSpan }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Custodes
Custodes may be engraved in various styles.
\layout { ragged-right = ##t } \new Staff \with { \consists "Custos_engraver" } \relative c' { \override Staff.Custos #'neutral-position = #4 \override Staff.Custos #'style = #'hufnagel c1^"hufnagel" \break <d a' f'>1 \override Staff.Custos #'style = #'medicaea c1^"medicaea" \break <d a' f'>1 \override Staff.Custos #'style = #'vaticana c1^"vaticana" \break <d a' f'>1 \override Staff.Custos #'style = #'mensural c1^"mensural" \break <d a' f'>1 }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Customizing fretboard fret diagrams
Fret diagram properties can be set through
'fret-diagram-details
. For FretBoard fret diagrams,
overrides are applied to the FretBoards.FretBoard
object.
Like Voice
, FretBoards
is a bottom level context,
therefore can be omitted in property overrides.
\include "predefined-guitar-fretboards.ly" \storePredefinedDiagram \chordmode { c' } #guitar-tuning #"x;1-1-(;3-2;3-3;3-4;1-1-);" << \new ChordNames { \chordmode { c1 c c d } } \new FretBoards { % Set global properties of fret diagram \override FretBoards.FretBoard #'size = #'1.2 \override FretBoard #'(fret-diagram-details finger-code) = #'in-dot \override FretBoard #'(fret-diagram-details dot-color) = #'white \chordmode { c \once \override FretBoard #'size = #'1.0 \once \override FretBoard #'(fret-diagram-details barre-type) = #'straight \once \override FretBoard #'(fret-diagram-details dot-color) = #'black \once \override FretBoard #'(fret-diagram-details finger-code) = #'below-string c' \once \override FretBoard #'(fret-diagram-details barre-type) = #'none \once \override FretBoard #'(fret-diagram-details number-type) = #'arabic \once \override FretBoard #'(fret-diagram-details orientation) = #'landscape \once \override FretBoard #'(fret-diagram-details mute-string) = #"M" \once \override FretBoard #'(fret-diagram-details label-dir) = #LEFT \once \override FretBoard #'(fret-diagram-details dot-color) = #'black c' \once \override FretBoard #'(fret-diagram-details finger-code) = #'below-string \once \override FretBoard #'(fret-diagram-details dot-radius) = #0.35 \once \override FretBoard #'(fret-diagram-details dot-position) = #0.5 \once \override FretBoard #'(fret-diagram-details fret-count) = #3 d } } \new Voice { c'1 c' c' d' } >>
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Customizing markup fret diagrams
Fret diagram properties can be set through
'fret-diagram-details
. For markup fret diagrams, overrides
can be applied to the Voice.TextScript
object or directly
to the markup.
<< \chords { c1 c c d } \new Voice = "mel" { \textLengthOn % Set global properties of fret diagram \override TextScript #'size = #'1.2 \override TextScript #'(fret-diagram-details finger-code) = #'in-dot \override TextScript #'(fret-diagram-details dot-color) = #'white %% C major for guitar, no barre, using defaults % terse style c'1^\markup { \fret-diagram-terse #"x;3-3;2-2;o;1-1;o;" } %% C major for guitar, barred on third fret % verbose style % size 1.0 % roman fret label, finger labels below string, straight barre c'1^\markup { % standard size \override #'(size . 1.0) { \override #'(fret-diagram-details . ( (number-type . roman-lower) (finger-code . in-dot) (barre-type . straight))) { \fret-diagram-verbose #'((mute 6) (place-fret 5 3 1) (place-fret 4 5 2) (place-fret 3 5 3) (place-fret 2 5 4) (place-fret 1 3 1) (barre 5 1 3)) } } } %% C major for guitar, barred on third fret % verbose style % landscape orientation, arabic numbers, M for mute string % no barre, fret label down or left, small mute label font c'1^\markup { \override #'(fret-diagram-details . ( (finger-code . below-string) (number-type . arabic) (label-dir . -1) (mute-string . "M") (orientation . landscape) (barre-type . none) (xo-font-magnification . 0.4) (xo-padding . 0.3))) { \fret-diagram-verbose #'((mute 6) (place-fret 5 3 1) (place-fret 4 5 2) (place-fret 3 5 3) (place-fret 2 5 4) (place-fret 1 3 1) (barre 5 1 3)) } } %% simple D chord % terse style % larger dots, centered dots, fewer frets % label below string d'1^\markup { \override #'(fret-diagram-details . ( (finger-code . below-string) (dot-radius . 0.35) (dot-position . 0.5) (fret-count . 3))) { \fret-diagram-terse #"x;x;o;2-1;3-2;2-3;" } } } >>
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Display bracket with only one staff in a system
If there is only one staff in one of the staff types
ChoirStaff
or StaffGroup
, the bracket and the starting
bar line will not be displayed as standard behavior. This can be changed
by overriding the relevant properties.
Note that in contexts such as PianoStaff
and GrandStaff
where the systems begin with a brace instead of a bracket, another
property has to be set, as shown on the second system in the example.
\markup \left-column { \score { \new StaffGroup << % Must be lower than the actual number of staff lines \override StaffGroup.SystemStartBracket #'collapse-height = #1 \override Score.SystemStartBar #'collapse-height = #1 \new Staff { c'1 } >> \layout { } } \score { \new PianoStaff << \override PianoStaff.SystemStartBrace #'collapse-height = #1 \override Score.SystemStartBar #'collapse-height = #1 \new Staff { c'1 } >> \layout { } } }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Dotted harmonics
Artificial harmonics using \harmonic
do not show
dots. To override this behavior, set the context property
harmonicDots
.
\relative c''' { \time 3/4 \key f \major \set harmonicDots = ##t <bes f'\harmonic>2. ~ <bes f'\harmonic>4. <a e'\harmonic>8( <gis dis'\harmonic> <g d'\harmonic>) <fis cis'\harmonic>2. <bes f'\harmonic>2. }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Drawing boxes around grobs
The print-function
can be overridden to draw a box around an
arbitrary grob.
\relative c'' { \override TextScript #'stencil = #(make-stencil-boxer 0.1 0.3 ly:text-interface::print) c'4^"foo" \override Stem #'stencil = #(make-stencil-boxer 0.05 0.25 ly:stem::print) \override Score.RehearsalMark #'stencil = #(make-stencil-boxer 0.15 0.3 ly:text-interface::print) b8 \revert Stem #'stencil c4. c4 \mark "F" c1 }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Drawing circles around various objects
The \circle
markup command draws circles around various objects,
for example fingering indications. For other objects, specific tweaks
may be required: this example demonstrates two strategies for rehearsal
marks and measure numbers.
\relative c' { c1 \set Score.markFormatter = #(lambda (mark context) (make-circle-markup (format-mark-numbers mark context))) \mark \default c2 d^\markup { \override #'(thickness . 3) { \circle \finger 2 } } \override Score.BarNumber #'break-visibility = #all-visible \override Score.BarNumber #'stencil = #(make-stencil-circler 0.1 0.25 ly:text-interface::print) }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Fine-tuning pedal brackets
The appearance of pedal brackets may be altered in different ways.
\paper { ragged-right = ##f } \relative c'' { c2\sostenutoOn c c2\sostenutoOff c \once \override Staff.PianoPedalBracket #'shorten-pair = #'(-7 . -2) c2\sostenutoOn c c2\sostenutoOff c \once \override Staff.PianoPedalBracket #'edge-height = #'(0 . 3) c2\sostenutoOn c c2\sostenutoOff c }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Forcing horizontal shift of notes
When the typesetting engine cannot cope, the following syntax can be used to override typesetting decisions. The units of measure used here are staff spaces.
\relative c' << { <d g>2 <d g> } \\ { <b f'>2 \once \override NoteColumn #'force-hshift = #1.7 <b f'>2 } >>
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Fret diagrams explained and developed
This snippet shows many possibilities for obtaining and tweaking fret diagrams.
<< \chords { a2 a c2 c d1 } \new Voice = "mel" { \textLengthOn % Set global properties of fret diagram \override TextScript #'size = #1.2 \override TextScript #'fret-diagram-details #'finger-code = #'below-string \override TextScript #'fret-diagram-details #'dot-color = #'black %% A chord for ukelele a'2^\markup { \override #'(fret-diagram-details . ( (string-count . 4) (dot-color . white) (finger-code . in-dot))) { \fret-diagram #"4-2-2;3-1-1;2-o;1-o;" } } %% A chord for ukelele, with formatting defined in definition string % 1.2 * size, 4 strings, 4 frets, fingerings below string % dot radius .35 of fret spacing, dot position 0.55 of fret spacing a'2^\markup { \override #'(fret-diagram-details . ( (dot-color . white) (open-string . "o"))) { \fret-diagram #"s:1.2;w:4;h:3;f:2;d:0.35;p:0.55;4-2-2;3-1-1;2-o;1-o;" } } %% C major for guitar, barred on third fret % verbose style % roman fret label, finger labels below string, straight barre c'2^\markup { % 110% of default size \override #'(size . 1.1) { \override #'(fret-diagram-details . ( (number-type . roman-lower) (finger-code . below-string) (barre-type . straight))) { \fret-diagram-verbose #'((mute 6) (place-fret 5 3 1) (place-fret 4 5 2) (place-fret 3 5 3) (place-fret 2 5 4) (place-fret 1 3 1) (barre 5 1 3)) } } } %% C major for guitar, barred on third fret % verbose style c'2^\markup { % 110% of default size \override #'(size . 1.1) { \override #'(fret-diagram-details . ( (number-type . arabic) (dot-label-font-mag . 0.9) (finger-code . in-dot) (fret-label-font-mag . 0.6) (fret-label-vertical-offset . 0) (label-dir . -1) (mute-string . "M") (orientation . landscape) (xo-font-magnification . 0.4) (xo-padding . 0.3))) { \fret-diagram-verbose #'((mute 6) (place-fret 5 3 1) (place-fret 4 5 2) (place-fret 3 5 3) (place-fret 2 5 4) (place-fret 1 3 1) (barre 5 1 3)) } } } %% simple D chord d'1^\markup { \override #'(fret-diagram-details . ( (finger-code . below-string) (dot-radius . 0.35) (dot-position . 0.5) (fret-count . 3))) { \fret-diagram-terse #"x;x;o;2-1;3-2;2-3;" } } } >>
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Horizontally aligning custom dynamics (e.g. "sempre pp", "piu f", "subito p")
Some dynamic expressions involve additional text, like "sempre pp". Since lilypond aligns all dynamics centered on the note, the \pp would be displayed way after the note it applies to.
To correctly align the "sempre \pp" horizontally, so that it is aligned as if it were only the \pp, there are several approaches:
* Simply use \once\override DynamicText #'X-offset = #-9.2
before the note with the dynamics to manually shift it to the correct
position. Drawback: This has to be done manually each time you use that
dynamic markup... * Add some padding (#:hspace 7.1
) into the
definition of your custom dynamic mark, so that after lilypond
center-aligns it, it is already correctly aligned. Drawback: The
padding really takes up that space and does not allow any other markup
or dynamics to be shown in that position.
* Shift the dynamic script \once\override ... #'X-offset = ..
.
Drawback: \once\override
is needed for every invocation!
* Set the dimensions of the additional text to 0 (using
#:with-dimensions '(0 . 0) '(0 . 0)
). Drawback: To lilypond
"sempre" has no extent, so it might put other stuff there and create
collisions (which are not detected by the collision dection!). Also,
there seems to be some spacing, so it’s not exactly the same alignment
as without the additional text
* Add an explicit shifting directly inside the scheme function for the dynamic-script.
* Set an explicit alignment inside the dynamic-script. By default, this
won’t have any effect, only if one sets X-offset! Drawback: One needs
to set DynamicText #'X-offset
, which will apply to all dynamic
texts! Also, it is aligned at the right edge of the additional text,
not at the center of pp.
\header { title = "Horizontally aligning custom dynamics" } \layout { ragged-right = ##t } % Solution 1: Using a simple markup with a particular halign value % Drawback: It's a markup, not a dynamic command, so \dynamicDown etc. will have no effect semppMarkup = \markup { \halign #1.4 \italic "sempre" \dynamic "pp" } % Solution 2: Using a dynamic script and shifting with \once\override ... #'X-offset = .. % Drawback: \once\override needed for every invocation semppK = #(make-dynamic-script (markup #:line( #:normal-text #:italic "sempre" #:dynamic "pp"))) % Solution 3: Padding the dynamic script so the center-alignment puts it to the correct position % Drawback: the padding really reserves the space, nothing else can be there semppT = #( make-dynamic-script ( markup #:line ( #:normal-text #:italic "sempre" #:dynamic "pp" #:hspace 7.1 ) ) ) % Solution 4: Dynamic, setting the dimensions of the additional text to 0 % Drawback: To lilypond "sempre" has no extent, so it might put other stuff there => collisions % Drawback: Also, there seems to be some spacing, so it's not exactly the % same alignment as without the additional text semppM = #(make-dynamic-script (markup #:line( #:with-dimensions '(0 . 0) '(0 . 0) #:right-align #:normal-text #:italic "sempre" #:dynamic "pp"))) % Solution 5: Dynamic with explicit shifting inside the scheme function semppG = #(make-dynamic-script (markup #:hspace 0 #:translate (cons -18.85 0 ) #:line( #:normal-text #:italic "sempre" #:dynamic "pp")) ) % Solution 6: Dynamic with explicit alignment. This has only effect, if one sets X-offset! % Drawback: One needs to set DynamicText #'X-offset! % Drawback: Aligned at the right edge of the additional text, not at the center of pp semppMII = #(make-dynamic-script (markup #:line(#:right-align #:normal-text #:italic "sempre" #:dynamic "pp"))) \context StaffGroup << \context Staff="s" << \set Staff.instrumentName = "Normal" \relative c'' { \key es \major c4\pp c\p c c | c\ff c c\pp c } >> \context Staff="sMarkup" << \set Staff.instrumentName = \markup\column{"Normal" "Markup"} \relative c'' { \key es \major c4-\semppMarkup c\p c c | c\ff c c-\semppMarkup c} >> \context Staff="sK" << \set Staff.instrumentName = \markup\column{"Explicit" "shifting"} \relative c'' { \key es \major \once \override DynamicText #'X-offset = #-9.2 c4\semppK c\p c c | c\ff c \once \override DynamicText #'X-offset = #-9.2 c\semppK c } >> \context Staff="sT" << \set Staff.instrumentName = \markup\column{"Right" "padding"} \relative c'' { \key es \major c4\semppT c\p c c | c\ff c c\semppT c } >> \context Staff="sM" << \set Staff.instrumentName = \markup\column{"Setting" "dimension" "to zero"} \relative c'' { \key es \major c4\semppM c\p c c | c\ff c c\semppM c } >> \context Staff="sG" << \set Staff.instrumentName = \markup\column{"Shifting" "inside" "dynamics"} \relative c'' { \key es \major c4\semppG c\p c c | c\ff c c\semppG c} >> \context Staff="sMII" << \set Staff.instrumentName = \markup\column{"Alignment" "inside" "dynamics"} \relative c'' { \key es \major \override DynamicText #'X-offset = #0 % Setting to ##f (false) gives the same resul c4\semppMII c\p c c | c\ff c c\semppMII c } >> >>
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
How to change fret diagram position
If you want to move the position of a fret diagram, for example, to avoid collision, or to place it between two notes, you have various possibilities:
1) modify #’padding or #’extra-offset values (as shown in the first snippet)
2) you can add an invisible voice and attach the fret diagrams to the invisible notes in that voice (as shown in the second example).
If you need to move the fret according with a rythmic position inside the bar (in the example, the third beat of the measure) the second example is better, because the fret is aligned with the third beat itself.
harmonies = \chordmode { a8:13 % THE FOLLOWING IS THE COMMAND TO MOVE THE CHORD NAME \once \override ChordNames.ChordName #'extra-offset = #'(10 . 0) b8:13 s2. % THIS LINE IS THE SECOND METHOD s4 s4 b4:13 } \score { << \context ChordNames \harmonies \context Staff {a8^\markup { \fret-diagram #"6-x;5-0;4-2;3-0;2-0;1-2;" } % THE FOLLOWING IS THE COMMAND TO MOVE THE FRET DIAGRAM \once \override TextScript #'extra-offset = #'(10 . 0) b4.~^\markup { \fret-diagram #"6-x;5-2;4-4;3-2;2-2;1-4;" } b4. a8\break % HERE IS THE SECOND METHOD << { a8 b4.~ b4. a8} { s4 s4 s4^\markup { \fret-diagram #"6-x;5-2;4-4;3-2;2-2;1-4;" } } >> } >> }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Inserting a caesura
Caesura marks can be created by overriding the 'text
property of the BreathingSign
object. A curved caesura
mark is also available.
\relative c'' { \override BreathingSign #'text = \markup { \musicglyph #"scripts.caesura.straight" } c8 e4. \breathe g8. e16 c4 \override BreathingSign #'text = \markup { \musicglyph #"scripts.caesura.curved" } g8 e'4. \breathe g8. e16 c4 }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Making an object invisible with the transparent property
Setting the 'transparent
property will cause an object to be
printed in "invisible ink": the object is not printed, but all its
other behavior is retained. The object still takes up space, it takes
part in collisions, and slurs, ties and beams can be attached to it.
This snippet demonstrates how to connect different voices using ties. Normally, ties only connect two notes in the same voice. By introducing a tie in a different voice, and blanking the first up-stem in that voice, the tie appears to cross voices. To prevent the blanked stem’s flag from interfering with tie positioning, the stem is extended.
\relative c'' { \time 2/4 << { \once \override Stem #'transparent = ##t \once \override Stem #'length = #8 b8 ~ b\noBeam \once \override Stem #'transparent = ##t \once \override Stem #'length = #8 g8 ~ g\noBeam } \\ { b8 g g e } >> }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Manually controlling beam positions
Beam positions may be controlled manually, by overriding the
positions
setting of the Beam
grob.
\relative c' { \time 2/4 % from upper staff-line (position 2) to center (position 0) \override Beam #'positions = #'(2 . 0) c8 c % from center to one above center (position 1) \override Beam #'positions = #'(0 . 1) c8 c }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Mensurstriche layout (bar lines between the staves)
The mensurstriche-layout where the bar lines do not show on the staves
but between staves can be achieved with a StaffGroup
instead of
a ChoirStaff
. The bar line on staves is blanked out by setting
the transparent
property.
global = { \override Staff.BarLine #'transparent = ##t s1 s % the final bar line is not interrupted \revert Staff.BarLine #'transparent \bar "|." } \new StaffGroup \relative c'' { << \new Staff { << \global { c1 c } >> } \new Staff { << \global { c c } >> } >> }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Nesting staves
The property systemStartDelimiterHierarchy
can be used to make
more complex nested staff groups. The command \set
StaffGroup.systemStartDelimiterHierarchy
takes an alphabetical list of
the number of staves produced. Before each staff a system start
delimiter can be given. It has to be enclosed in brackets and takes as
much staves as the brackets enclose. Elements in the list can be
omitted, but the first bracket takes always the complete number of
staves. The possibilities are SystemStartBar
,
SystemStartBracket
, SystemStartBrace
, and
SystemStartSquare
.
\new StaffGroup \relative c'' << \set StaffGroup.systemStartDelimiterHierarchy = #'(SystemStartSquare (SystemStartBrace (SystemStartBracket a (SystemStartSquare b) ) c ) d) \new Staff { c1 } \new Staff { c1 } \new Staff { c1 } \new Staff { c1 } \new Staff { c1 } >>
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Percent repeat count visibility
Percent repeat counters can be shown at regular intervals by setting
the context property repeatCountVisibility
.
\relative c'' { \set countPercentRepeats = ##t \set repeatCountVisibility = #(every-nth-repeat-count-visible 5) \repeat percent 10 { c1 } \break \set repeatCountVisibility = #(every-nth-repeat-count-visible 2) \repeat percent 6 { c1 d1 } }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Positioning multi-measure rests
Unlike ordinary rests, there is no predefined command to change the staff position of a multi-measure rest symbol of either form by attaching it to a note. However, in polyphonic music multi-measure rests in odd-numbered and even-numbered voices are vertically separated. The positioning of multi-measure rests can be controlled as follows:
\relative c'' { % Multi-measure rests by default are set under the second line R1 % They can be moved with an override \override MultiMeasureRest #'staff-position = #-2 R1 % A value of 0 is the default position; % the following trick moves the rest to the center line \override MultiMeasureRest #'staff-position = #-0.01 R1 % Multi-measure rests in odd-numbered voices are under the top line << { R1 } \\ { a1 } >> % Multi-measure rests in even-numbered voices are under the bottom line << { c1 } \\ { R1 } >> % They remain separated even in empty measures << { R1 } \\ { R1 } >> % This brings them together even though there are two voices \compressFullBarRests << \revert MultiMeasureRest #'staff-position { R1*3 } \\ \revert MultiMeasureRest #'staff-position { R1*3 } >> }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Positioning text markups inside slurs
Text markups need to have the outside-staff-priority
property
set to false in order to be printed inside slurs.
\relative c'' { \override TextScript #'avoid-slur = #'inside \override TextScript #'outside-staff-priority = ##f c2(^\markup { \halign #-10 \natural } d4.) c8 }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Printing a repeat sign at the beginning of a piece
A |:
bar line can be printed at the beginning of a piece, by
overriding the relevant property:
\relative c'' { \once \override Score.BreakAlignment #'break-align-orders = #(make-vector 3 '(instrument-name left-edge ambitus span-bar breathing-sign clef key-signature time-signature staff-bar custos span-bar)) \bar "|:" c1 d1 d4 e f g }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Printing metronome and rehearsal marks below the staff
By default, metronome and rehearsal marks are printed above the staff.
To place them below the staff simply set the direction
property
of MetronomeMark
or RehearsalMark
appropriately.
\layout { ragged-right = ##f } { % Metronome marks below the staff \override Score.MetronomeMark #'direction = #DOWN \tempo 8. = 120 c''1 % Rehearsal marks below the staff \override Score.RehearsalMark #'direction = #DOWN \mark \default c''1 }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Proportional strict notespacing
If strict-note-spacing
is set spacing of notes is not influenced
by bars or clefs within a system. Rather, they are placed just before
the note that occurs at the same time. This may cause collisions.
\paper { ragged-right = ##t } \relative c'' << \override Score.SpacingSpanner #'strict-note-spacing = ##t \set Score.proportionalNotationDuration = #(ly:make-moment 1 16) \new Staff { c8[ c \clef alto c c \grace { d16 } c8 c] c4 c2 \grace { c16[ c16] } c2 } \new Staff { c2 \times 2/3 { c8 \clef bass cis,, c } c4 c1 } >>
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Removing the first empty line
The first empty staff can also be removed from the score by setting the
VerticalAxisGroup
property remove-first
. This can be done
globally inside the \layout
block, or locally inside the
specific staff that should be removed. In the latter case, you have to
specify the context (Staff
applies only to the current staff) in
front of the property.
The lower staff of the second staff group is not removed, because the setting applies only to the specific staff inside of which it is written.
\layout { \context { \RemoveEmptyStaffContext % To use the setting globally, uncomment the following line: % \override VerticalAxisGroup #'remove-first = ##t } } \new StaffGroup << \new Staff \relative c' { e4 f g a \break c1 } \new Staff { % To use the setting globally, comment this line, % uncomment the line in the \layout block above \override Staff.VerticalAxisGroup #'remove-first = ##t R1 \break R } >> \new StaffGroup << \new Staff \relative c' { e4 f g a \break c1 } \new Staff { R1 \break R } >>
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Rest styles
Rests may be used in various styles.
\layout { indent = 0.0 \context { \Staff \remove "Time_signature_engraver" } } \new Staff \relative c { \cadenzaOn \override Staff.Rest #'style = #'mensural r\maxima^\markup \typewriter { mensural } r\longa r\breve r1 r2 r4 r8 r16 s32 s64 s128 s128 \bar "" \override Staff.Rest #'style = #'neomensural r\maxima^\markup \typewriter { neomensural } r\longa r\breve r1 r2 r4 r8 r16 s32 s64 s128 s128 \bar "" \override Staff.Rest #'style = #'classical r\maxima^\markup \typewriter { classical } r\longa r\breve r1 r2 r4 r8 r16 r32 r64 r128 s128 \bar "" \override Staff.Rest #'style = #'default r\maxima^\markup \typewriter { default } r\longa r\breve r1 r2 r4 r8 r16 r32 r64 r128 s128 }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Rhythmic slashes
In "simple" lead-sheets, sometimes no actual notes are written,
instead only "rhythmic patterns" and chords above the measures are
notated giving the structure of a song. Such a feature is for example
useful while creating/transcribing the structure of a song and also
when sharing lead sheets with guitarists or jazz musicians. The
standard support for this using \repeat percent
is unsuitable
here since the first beat has to be an ordinary note or rest. This
example shows two solutions to this problem, by redefining ordinary
rests to be printed as slashes. (If the duration of each beat is not a
quarter note, replace the r4
in the definitions with a rest of
the appropriate duration).
% Macro to print single slash rs = { \once \override Rest #'stencil = #ly:percent-repeat-item-interface::beat-slash \once \override Rest #'thickness = #0.48 \once \override Rest #'slope = #1.7 r4 } % Function to print a specified number of slashes comp = #(define-music-function (parser location count) ( integer?) #{ \override Rest #'stencil = #ly:percent-repeat-item-interface::beat-slash \override Rest #'thickness = #0.48 \override Rest #'slope = #1.7 \repeat unfold $count { r4 } \revert Rest #'stencil #} ) \score { \relative c' { c4 d e f | \rs \rs \rs \rs | \comp #4 | } }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Suppressing warnings for clashing note columns
If notes from two voices with stems in the same direction are
placed at the same position, and both voices have no shift or the
same shift specified, the error message "warning: ignoring too
many clashing note columns" will appear when compiling the
LilyPond file. This message can be suppressed by setting the
'ignore-collision
property of the NoteColumn
object
to #t
.
ignore = \override NoteColumn #'ignore-collision = ##t \relative c' { << \ignore { \stemDown f2 g } \\ { c2 c, } >> }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Time signature in parentheses
The time signature can be enclosed within parentheses.
\relative c'' { \override Staff.TimeSignature #'stencil = #(lambda (grob) (bracketify-stencil (ly:time-signature::print grob) Y 0.1 0.2 0.1)) \time 2/4 a4 b8 c }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Transcription of Ancient music with incipit
As a workaround to get real incipits which are independent from the main score these are included as a markup into the field normally used for the instrument name. As for now lyrics can only be added as a direct markup. It doesn’t unfortunately conform with the spacing of the main lyrics.
global = { \set Score.skipBars = ##t \key g \major \time 4/4 %make the staff lines invisible on staves \override Staff.BarLine #'transparent = ##t \skip 1*8 % the actual music % let finis bar go through all staves \override Staff.BarLine #'transparent = ##f % finis bar \bar "|." } discantusNotes = { \transpose c' c'' { \clef "treble" d'2. d'4 | b e' d'2 | c'4 e'4.( d'8 c' b | a4) b a2 | b4.( c'8 d'4) c'4 | \once \override NoteHead #'transparent = ##t c'1 | b\breve | } } discantusLyrics = \lyricmode { Ju -- bi -- | la -- te De -- | o, om -- nis ter -- | ra, __ om- | "..." | -us. | } altusNotes = { \transpose c' c'' { \clef "treble" r2 g2. e4 fis g | % two bars a2 g4 e | fis g4.( fis16 e fis4) | g1 | \once \override NoteHead #'transparent = ##t g1 | g\breve | } } altusLyrics = \lyricmode { Ju -- bi -- la -- te | % two bars De -- o, om -- | nis ter -- ra, | "..." | -us. | } tenorNotes = { \transpose c' c' { \clef "treble_8" R1 | R1 | R1 | r2 d'2. d'4 b e' | % two bars \once \override NoteHead #'transparent = ##t e'1 | d'\breve | } } tenorLyrics = \lyricmode { Ju -- bi -- la -- te | % two bars "..." | -us. } bassusNotes = { \transpose c' c' { \clef "bass" R1 | R1 | R1 | R1 | g2. e4 | \once \override NoteHead #'transparent = ##t e1 | g\breve | } } bassusLyrics = \lyricmode { Ju -- bi- | "..." | -us. } incipitDiscantus = \markup{ \score{ { \set Staff.instrumentName="Discantus " \override NoteHead #'style = #'neomensural \override Rest #'style = #'neomensural \override Staff.TimeSignature #'style = #'neomensural \cadenzaOn \clef "neomensural-c1" \key f \major \time 2/2 c''1._"IV-" s2 %two bars \skip 1*8 % eight bars } \layout { \context {\Voice \remove Ligature_bracket_engraver \consists Mensural_ligature_engraver } line-width=4.5\cm } } } incipitAltus = \markup{ \score{ { \set Staff.instrumentName="Altus " \override NoteHead #'style = #'neomensural \override Rest #'style = #'neomensural \override Staff.TimeSignature #'style = #'neomensural \cadenzaOn \clef "neomensural-c3" \key f \major \time 2/2 r1 % one bar f'1._"IV-" s2 % two bars \skip 1*7 % seven bars } \layout { \context {\Voice \remove Ligature_bracket_engraver \consists Mensural_ligature_engraver } line-width=4.5\cm } } } incipitTenor = \markup{ \score{ { \set Staff.instrumentName = "Tenor " \override NoteHead #'style = #'neomensural \override Rest #'style = #'neomensural \override Staff.TimeSignature #'style = #'neomensural \cadenzaOn \clef "neomensural-c4" \key f \major \time 2/2 r\longa % four bars r\breve % two bars r1 % one bar c'1._"IV-" s2 % two bars \skip 1 % one bar } \layout { \context {\Voice \remove Ligature_bracket_engraver \consists Mensural_ligature_engraver } line-width=4.5\cm } } } incipitBassus = \markup{ \score{ { \set Staff.instrumentName = "Bassus " \override NoteHead #'style = #'neomensural \override Rest #'style = #'neomensural \override Staff.TimeSignature #'style = #'neomensural \cadenzaOn \clef "bass" \key f \major \time 2/2 % incipit r\maxima % eight bars f1._"IV-" s2 % two bars } \layout { \context {\Voice \remove Ligature_bracket_engraver \consists Mensural_ligature_engraver } line-width=4.5\cm } } } %StaffGroup is used instead of ChoirStaff to get bar lines between systems \score { << \new StaffGroup = choirStaff << \new Voice = "discantusNotes" << \global \set Staff.instrumentName=\incipitDiscantus \discantusNotes >> \new Lyrics = "discantusLyrics" \lyricsto discantusNotes { \discantusLyrics } \new Voice = "altusNotes" << \global \set Staff.instrumentName=\incipitAltus \altusNotes >> \new Lyrics = "altusLyrics" \lyricsto altusNotes { \altusLyrics } \new Voice = "tenorNotes" << \global \set Staff.instrumentName=\incipitTenor \tenorNotes >> \new Lyrics = "tenorLyrics" \lyricsto tenorNotes { \tenorLyrics } \new Voice = "bassusNotes" << \global \set Staff.instrumentName=\incipitBassus \bassusNotes >> >> \new Lyrics = "bassusLyrics" \lyricsto bassusNotes { \bassusLyrics } %Keep the bass lyrics outside of the staff group to avoid bar lines %between the lyrics. >> \layout { \context { \Score % no bars in staves \override BarLine #'transparent = ##t } % the next three instructions keep the lyrics between the barlines \context { \Lyrics \consists "Bar_engraver" \override BarLine #'transparent = ##t } \context { \StaffGroup \consists "Separating_line_group_engraver" } \context { \Voice % no slurs \override Slur #'transparent = ##t % Comment in the below "\remove" command to allow line % breaking also at those barlines where a note overlaps % into the next bar. The command is commented out in this % short example score, but especially for large scores, you % will typically yield better line breaking and thus improve % overall spacing if you comment in the following command. %\remove "Forbid_line_break_engraver" } indent=5\cm } }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Tweaking clef properties
The command \clef "treble_8"
is equivalent to setting
clefGlyph
, clefPosition
(which controls the vertical
position of the clef), middleCPosition
and
clefOctavation
. A clef is printed when any of the properties
except middleCPosition
are changed.
Note that changing the glyph, the position of the clef, or the
octavation does not in itself change the position of subsequent notes
on the staff: the position of middle C must also be specified to do
this. The positional parameters are relative to the staff center line,
positive numbers displacing upwards, counting one for each line and
space. The clefOctavation
value would normally be set to 7, -7,
15 or -15, but other values are valid.
When a clef change takes place at a line break the new clef symbol is
printed at both the end of the previous line and the beginning of the
new line by default. If the warning clef at the end of the previous
line is not required it can be suppressed by setting the Staff
property explicitClefVisibility
to the value
end-of-line-invisible
. The default behavior can be recovered
with \unset Staff.explicitClefVisibility
.
The following examples show the possibilities when setting these properties manually. On the first line, the manual changes preserve the standard relative positioning of clefs and notes, whereas on the second line, they do not.
\layout { ragged-right = ##t } { % The default treble clef c'1 % The standard bass clef \set Staff.clefGlyph = #"clefs.F" \set Staff.clefPosition = #2 \set Staff.middleCPosition = #6 c'1 % The baritone clef \set Staff.clefGlyph = #"clefs.C" \set Staff.clefPosition = #4 \set Staff.middleCPosition = #4 c'1 % The standard choral tenor clef \set Staff.clefGlyph = #"clefs.G" \set Staff.clefPosition = #-2 \set Staff.clefOctavation = #-7 \set Staff.middleCPosition = #1 c'1 % A non-standard clef \set Staff.clefPosition = #0 \set Staff.clefOctavation = #0 \set Staff.middleCPosition = #-4 c'1 \break % The following clef changes do not preserve % the normal relationship between notes and clefs: \set Staff.clefGlyph = #"clefs.F" \set Staff.clefPosition = #2 c'1 \set Staff.clefGlyph = #"clefs.G" c'1 \set Staff.clefGlyph = #"clefs.C" c'1 \set Staff.clefOctavation = #7 c'1 \set Staff.clefOctavation = #0 \set Staff.clefPosition = #0 c'1 % Return to the normal clef: \set Staff.middleCPosition = #0 c'1 }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Using PostScript to generate special note head shapes
When a note head with a special shape cannot easily be generated with graphic markup, PostScript code can be used to generate the shape. This example shows how a parallelogram-shaped note head is generated.
parallelogram = #(ly:make-stencil (list 'embedded-ps "gsave currentpoint translate newpath 0 0.25 moveto 1.3125 0.75 lineto 1.3125 -0.25 lineto 0 -0.75 lineto closepath fill grestore" ) (cons 0 1.3125) (cons 0 0)) myNoteHeads = \override NoteHead #'stencil = \parallelogram normalNoteHeads = \revert NoteHead #'stencil \relative c'' { \myNoteHeads g4 d' \normalNoteHeads <f, \tweak #'stencil \parallelogram b e>4 d }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Using the \tweak
command to tweak individual grobs
With the \tweak
command, every grob can be tuned directly. Here
are some examples of available tweaks.
\relative c' { \time 2/4 \set fingeringOrientations = #'(right) < \tweak #'font-size #3 c \tweak #'color #red d-\tweak #'font-size #8 -4 \tweak #'style #'cross g \tweak #'duration-log #2 a >2 }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ > ] |
Vertically aligned dynamics and textscripts
By setting the 'Y-extent
property to a suitable value, all
DynamicLineSpanner
objects (hairpins and dynamic texts) can be
aligned to a common reference point, regardless of their actual extent.
This way, every element will be vertically aligned, thus producing a
more pleasing output.
The same idea is used to align the text scripts along their baseline.
music = \relative c'' { c2\p^\markup { gorgeous } c\f^\markup { fantastic } c4\p c\f\> c c\!\p } { \music \break \override DynamicLineSpanner #'staff-padding = #2.0 \override DynamicLineSpanner #'Y-extent = #'(-1.5 . 1.5) \override TextScript #'Y-extent = #'(-1.5 . 1.5) \music }
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ Paper and layout > ] |
Vertically aligning ossias and lyrics
This snippet demonstrates the use of the context properties
alignBelowContext
and alignAboveContext
to control the
positioning of lyrics and ossias.
\paper { ragged-right = ##t } \relative c' << \new Staff = "1" { c4 c s2 } \new Staff = "2" { c4 c s2 } \new Staff = "3" { c4 c s2 } { \skip 2 << \lyrics { \set alignBelowContext = #"1" lyrics4 below } \new Staff \with { alignAboveContext = #"3" fontSize = #-2 \override StaffSymbol #'staff-space = #(magstep -2) \remove "Time_signature_engraver" } { \times 4/6 { \override TextScript #'padding = #3 c8[^"ossia above" d e d e f] } } >> } >>
[ << Tweaks and overrides ] | [Top][Contents][Index][ ? ] | [ Paper and layout >> ] | ||
[ < ] | [ Up : Tweaks and overrides ] | [ Paper and layout > ] |