[ << Editorial annotations ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Editorial annotations: Using the whiteout property ] | [ Up : Top ] | [ Text: Adding markups in a tablature > ] |
Text
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text ] | [ Up : Text ] | [ Text: Adding the current date to a score > ] |
Adding markups in a tablature
By default markups does not show in a tablature. To make them appear,
simply use the command \revert TabStaff.TextScript.stencil
%% http://lsr.di.unimi.it/LSR/Item?id=919 % by P.P.Schneider on June 2014 high = { r4 r8 <g c'> q r8 r4 } low = { c4 r4 c8 r8 g,8 b, } pulse = { s8^"1" s^"&" s^"2" s^"&" s^"3" s^"&" s^"4" s^"&" } \score { \new TabStaff { \repeat unfold 2 << \high \\ \low \\ \pulse >> } \layout { \context { \TabStaff \clef moderntab \revert TextScript.stencil \override TextScript.font-series = #'bold \override TextScript.font-size = #-2 \override TextScript.color = #red } \context { \Score proportionalNotationDuration = #(ly:make-moment 1/8) } } }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Adding markups in a tablature ] | [ Up : Text ] | [ Text: Adjusting lyrics vertical spacing > ] |
Adding the current date to a score
With a little Scheme code, the current date can easily be added to a score.
% first, define a variable to hold the formatted date: date = #(strftime "%d-%m-%Y" (localtime (current-time))) % use it in the title block: \header { title = "Including the date!" subtitle = \date } \score { \relative c'' { c4 c c c } } % and use it in a \markup block: \markup { \date }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Adding the current date to a score ] | [ Up : Text ] | [ Text: Aligning and centering instrument names > ] |
Adjusting lyrics vertical spacing
This snippet shows how to bring the lyrics line closer to the staff.
% Default layout: << \new Staff \new Voice = melody \relative c' { c4 d e f g4 f e d c1 } \new Lyrics \lyricsto melody { aa aa aa aa aa aa aa aa aa } \new Staff { \new Voice = melody \relative c' { c4 d e f g4 f e d c1 } } % Reducing the minimum space below the staff and above the lyrics: \new Lyrics \with { \override VerticalAxisGroup.nonstaff-relatedstaff-spacing = #'((basic-distance . 1)) } \lyricsto melody { aa aa aa aa aa aa aa aa aa } >>
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Adjusting lyrics vertical spacing ] | [ Up : Text ] | [ Text: Aligning objects created with the \mark command > ] |
Aligning and centering instrument names
The horizontal alignment of instrument names is tweaked by changing the
Staff.InstrumentName #'self-alignment-X
property. The
\layout
variables indent
and short-indent
define
the space in which the instrument names are aligned before the first
and the following systems, respectively.
\score { \new StaffGroup << \new Staff \with { \override InstrumentName.self-alignment-X = #LEFT instrumentName = \markup \left-column { "Left aligned" "instrument name" } shortInstrumentName = "Left" } { c''1 \break c''1 } \new Staff \with { \override InstrumentName.self-alignment-X = #CENTER instrumentName = \markup \center-column { Centered "instrument name" } shortInstrumentName = "Centered" } { g'1 g'1} \new Staff \with { \override InstrumentName.self-alignment-X = #RIGHT instrumentName = \markup \right-column { "Right aligned" "instrument name" } shortInstrumentName = "Right" } { e'1 e'1 } >> \layout { ragged-right = ##t indent = 4\cm short-indent = 2\cm } }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Aligning and centering instrument names ] | [ Up : Text ] | [ Text: Aligning syllables with melisma > ] |
Aligning objects created with the \mark command
By default the \mark
command centers objects over a bar line.
This behavior can be modified to align at right or left.
\relative c' { c1 \mark "(Center)" c1 \once \override Score.RehearsalMark.self-alignment-X = #LEFT \mark "(Left)" c4 c c c c4 c c c \once \override Score.RehearsalMark.self-alignment-X = #RIGHT \mark "(Right)" c1 }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Aligning objects created with the \mark command ] | [ Up : Text ] | [ Text: Blanking staff lines using the \whiteout command > ] |
Aligning syllables with melisma
By default, lyrics syllables that start a melisma are left aligned on
their note. The alignment can be altered using the
lyricMelismaAlignment
property.
\score { << \new Staff { \relative c'' \new Voice = "vocal" { c d~^\markup default d e c d~^\markup "right aligned" d e c d~^\markup "center aligned" d e c d~^\markup "reset to default" d e } } \new Lyrics \lyricsto "vocal" { word word word \set lyricMelismaAlignment = #RIGHT word word word \set lyricMelismaAlignment = #CENTER word word word \unset lyricMelismaAlignment word word word } >> }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Aligning syllables with melisma ] | [ Up : Text ] | [ Text: Center text below hairpin dynamics > ] |
Blanking staff lines using the \whiteout command
The \whiteout
command underlays a markup with a white box.
Since staff lines are in a lower layer than most other grobs, this
white box will not overlap any other grob.
\layout { ragged-right = ##f } \relative c' { \override TextScript.extra-offset = #'(2 . 4) c2-\markup { \whiteout \pad-markup #0.5 "middle C" } c }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Blanking staff lines using the \whiteout command ] | [ Up : Text ] | [ Text: Changing ottava text > ] |
Center text below hairpin dynamics
This example provides a function to typeset a hairpin (de)crescendo with some additional text below it, such as “molto” or “poco”. The added text will change the direction according to the direction of the hairpin. The Hairpin is aligned to DynamicText.
The example also illustrates how to modify the way an object is normally printed, using some Scheme code.
hairpinWithCenteredText = #(define-music-function (text) (markup?) #{ \once \override Voice.Hairpin.after-line-breaking = #(lambda (grob) (let* ((stencil (ly:hairpin::print grob)) (par-y (ly:grob-parent grob Y)) (dir (ly:grob-property par-y 'direction)) (new-stencil (ly:stencil-aligned-to (ly:stencil-combine-at-edge (ly:stencil-aligned-to stencil X CENTER) Y dir (ly:stencil-aligned-to (grob-interpret-markup grob text) X CENTER)) X LEFT)) (staff-space (ly:output-def-lookup (ly:grob-layout grob) 'staff-space)) (staff-line-thickness (ly:output-def-lookup (ly:grob-layout grob) 'line-thickness)) (par-x (ly:grob-parent grob X)) (dyn-text (grob::has-interface par-x 'dynamic-text-interface)) (dyn-text-stencil-x-length (if dyn-text (interval-length (ly:stencil-extent (ly:grob-property par-x 'stencil) X)) 0)) (x-shift (if dyn-text (- (+ staff-space dyn-text-stencil-x-length) (* 0.5 staff-line-thickness)) 0))) (ly:grob-set-property! grob 'Y-offset 0) (ly:grob-set-property! grob 'stencil (ly:stencil-translate-axis new-stencil x-shift X)))) #}) hairpinMolto = \hairpinWithCenteredText \markup { \italic molto } hairpinMore = \hairpinWithCenteredText \markup { \larger moltissimo } \layout { ragged-right = ##f } \relative c' { \hairpinMolto c2\< c\f \hairpinMore c2\ppppp\< c\f \break \hairpinMolto c2^\< c\f \hairpinMore c2\ppppp\< c\f }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Center text below hairpin dynamics ] | [ Up : Text ] | [ Text: Changing the default text font family > ] |
Changing ottava text
Internally, \ottava
sets the properties ottavation
(for
example, to 8va
or 8vb
) and middleCPosition
. To
override the text of the bracket, set ottavation
after invoking
\ottava
.
Short text is especially useful when a brief ottava is used.
{ c'2 \ottava #1 \set Staff.ottavation = #"8" c''2 \ottava #0 c'1 \ottava #1 \set Staff.ottavation = #"Text" c''1 }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Changing ottava text ] | [ Up : Text ] | [ Text: Combining dynamics with markup texts > ] |
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,Nimbus Sans L" "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 } } }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Changing the default text font family ] | [ Up : Text ] | [ Text: Combining two parts on the same staff > ] |
Combining dynamics with markup texts
Some dynamics may involve text indications (such as “più forte” or
“piano subito”). These can be produced using a \markup
block.
piuF = \markup { \italic più \dynamic f } \layout { ragged-right = ##f } \relative c'' { c2\f c-\piuF }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Combining dynamics with markup texts ] | [ Up : Text ] | [ Text: Creating "real" parenthesized dynamics > ] |
Combining two parts on the same staff
The part combiner tool ( \partcombine
command ) allows the
combination of several different parts on the same staff. Text
directions such as “solo” or “a2” are added by default; to remove
them, simply set the property printPartCombineTexts
to f
.
For vocal scores (hymns), there is no need to add “solo/a2” texts,
so they should be switched off. However, it might be better not to use
it if there are any solos, as they won’t be indicated. In such cases,
standard polyphonic notation may be preferable.
This snippet presents the three ways two parts can be printed on a same
staff: standard polyphony, \partcombine
without texts, and
\partcombine
with texts.
musicDown = \relative c'' { g4 e4.( d8) c4 | r2 g'4( f8 e) | d2 \stemDown a } \score { << \new Staff \with { instrumentName = #"Standard polyphony" } << \musicUp \\ \musicDown >> \new Staff \with { instrumentName = #"PartCombine without text" printPartCombineTexts = ##f } \partcombine \musicUp \musicDown \new Staff \with { instrumentName = #"PartCombine with text" } \partcombine \musicUp \musicDown >> \layout { indent = 6.0\cm \context { \Score \override SystemStartBar.collapse-height = #30 } } }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Combining two parts on the same staff ] | [ Up : Text ] | [ Text: Creating simultaneous rehearsal marks > ] |
Creating "real" parenthesized dynamics
Although the easiest way to add parentheses to a dynamic mark is to use
a \markup
block, this method has a downside: the created
objects will behave like text markups, and not like dynamics.
However, it is possible to create a similar object using the equivalent
Scheme code (as described in the Notation Reference), combined with the
make-dynamic-script
function. This way, the markup will be
regarded as a dynamic, and therefore will remain compatible with
commands such as \dynamicUp
or \dynamicDown
.
paren = #(define-event-function (dyn) (ly:event?) (make-dynamic-script #{ \markup \concat { \normal-text \italic \fontsize #2 ( \pad-x #0.2 #(ly:music-property dyn 'text) \normal-text \italic \fontsize #2 ) } #})) \relative c'' { c4\paren\f c c \dynamicUp c\paren\p }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Creating "real" parenthesized dynamics ] | [ Up : Text ] | [ Text: Creating text spanners > ] |
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 % \cadenzaOn turns off automatic calculation of bar numbers \cadenzaOn \once \override Score.TimeSignature.stencil = ##f \time 1/16 s16 \bar "" \cadenzaOff \time 4/4 \once \override Score.RehearsalMark.self-alignment-X = #LEFT \mark \markup { \box \bold Intro } d'1 \mark \default d'1 }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Creating simultaneous rehearsal marks ] | [ Up : Text ] | [ Text: Demonstrating all headers > ] |
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 }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Creating text spanners ] | [ Up : Text ] | [ Text: Embedding native PostScript in a \markup block > ] |
Demonstrating all headers
All header fields with special meanings.
\header { copyright = "copyright" title = "title" subtitle = "subtitle" composer = "composer" arranger = "arranger" instrument = "instrument" metre = "metre" opus = "opus" piece = "piece" poet = "poet" texidoc = "All header fields with special meanings." copyright = "public domain" enteredby = "jcn" source = "urtext" } \layout { ragged-right = ##f } \score { \relative c'' { c1 | c | c | c } } \score { \relative c'' { c1 | c | c | c } \header { title = "localtitle" subtitle = "localsubtitle" composer = "localcomposer" arranger = "localarranger" instrument = "localinstrument" metre = "localmetre" opus = "localopus" piece = "localpiece" poet = "localpoet" copyright = "localcopyright" } }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Demonstrating all headers ] | [ Up : Text ] | [ Text: Formatting lyrics syllables > ] |
Embedding native PostScript in a \markup block
PostScript code can be directly inserted inside a \markup
block.
% PostScript is a registered trademark of Adobe Systems Inc. \relative c'' { a4-\markup { \postscript #"3 4 moveto 5 3 rlineto stroke" } -\markup { \postscript #"[ 0 1 ] 0 setdash 3 5 moveto 5 -3 rlineto stroke " } b4-\markup { \postscript #"3 4 moveto 0 0 1 2 8 4 20 3.5 rcurveto stroke" } s2 a'1 }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Embedding native PostScript in a \markup block ] | [ Up : Text ] | [ Text: How to put ties between syllables in lyrics > ] |
Formatting lyrics syllables
Markup mode may be used to format individual syllables in lyrics.
mel = \relative c'' { c4 c c c } lyr = \lyricmode { Lyrics \markup { \italic can } \markup { \with-color #red contain } \markup { \fontsize #8 \bold Markup! } } << \new Voice = melody \mel \new Lyrics \lyricsto melody \lyr >>
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Formatting lyrics syllables ] | [ Up : Text ] | [ Text: Lyrics alignment > ] |
How to put ties between syllables in lyrics
This can be achieved by separating those syllables by tildes.
\lyrics { wa~o~a }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: How to put ties between syllables in lyrics ] | [ Up : Text ] | [ Text: Markup lines > ] |
Lyrics alignment
Horizontal alignment for lyrics can be set by overriding the
self-alignment-X
property of the LyricText
object.
#-1
is left, #0
is center and #1
is right;
however, you can use #LEFT
, #CENTER
and #RIGHT
as
well.
\layout { ragged-right = ##f } \relative c'' { c1 c1 c1 } \addlyrics { \once \override LyricText.self-alignment-X = #LEFT "This is left-aligned" \once \override LyricText.self-alignment-X = #CENTER "This is centered" \once \override LyricText.self-alignment-X = #1 "This is right-aligned" }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Lyrics alignment ] | [ Up : Text ] | [ Text: Multi-measure rest markup > ] |
Markup lines
Text that can spread over pages is entered with the
\markuplines
command.
%% updated/modified by P.P.Schneider on Feb. 2014 #(set-default-paper-size "a6") #(define-markup-list-command (paragraph layout props args) (markup-list?) (interpret-markup-list layout props (make-justified-lines-markup-list (cons (make-hspace-markup 2) args)))) % Candide, Voltaire \markuplist { \override-lines #'(baseline-skip . 2.5) { \paragraph { Il y avait en Westphalie, dans le château de M. le baron de Thunder-ten-tronckh, un jeune garçon à qui la nature avait donné les mœurs les plus douces. Sa physionomie annonçait son âme. Il avait le jugement assez droit, avec l'esprit le plus \concat { simple \hspace #.3 ; } c'est, je crois, pour cette raison qu'on le nommait Candide. Les anciens domestiques de la maison soupçonnaient qu'il était fils de la sœur de monsieur le baron et d'un bon et honnête gentilhomme du voisinage, que cette demoiselle ne voulut jamais épouser parce qu'il n'avait pu prouver que soixante et onze quartiers, et que le reste de son arbre généalogique avait été perdu par l'injure du temps. } \vspace #.3 \paragraph { Monsieur le baron était un des plus puissants seigneurs de la Westphalie, car son château avait une porte et des fenêtres. Sa grande salle même était ornée d'une tapisserie. Tous les chiens de ses basses-cours composaient une meute dans le \concat { besoin \hspace #.3 ; } ses palefreniers étaient ses \concat { piqueurs \hspace #.3 ; } le vicaire du village était son grand-aumônier. Ils l'appelaient tous monseigneur, et ils riaient quand il faisait des contes. } } }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Markup lines ] | [ Up : Text ] | [ Text: Ottava text > ] |
Multi-measure rest markup
Markups attached to a multi-measure rest will be centered above or below it. Long markups attached to multi-measure rests do not cause the measure to expand. To expand a multi-measure rest to fit the markup, use an empty chord with an attached markup before the multi-measure rest.
Text attached to a spacer rest in this way is left-aligned to the position where the note would be placed in the measure, but if the measure length is determined by the length of the text, the text will appear to be centered.
\relative c' { \compressMMRests { \textLengthOn <>^\markup { [MAJOR GENERAL] } R1*19 <>_\markup { \italic { Cue: ... it is yours } } <>^\markup { A } R1*30^\markup { [MABEL] } \textLengthOff c4^\markup { CHORUS } d f c } }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Multi-measure rest markup ] | [ Up : Text ] | [ Text: Outputting the version number > ] |
Ottava text
Internally, \ottava
sets the properties ottavation
(for
example, to 8va
or 8vb
) and middleCPosition
. To
override the text of the bracket, set ottavation
after invoking
\ottava
.
{ \ottava #1 \set Staff.ottavation = #"8" c''1 \ottava #0 c'1 \ottava #1 \set Staff.ottavation = #"Text" c''1 }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Ottava text ] | [ Up : Text ] | [ Text: Piano template with centered lyrics > ] |
Outputting the version number
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:
\score { \new Lyrics { \override Score.RehearsalMark.self-alignment-X = #LEFT \mark #(string-append "Processed with LilyPond version " (lilypond-version)) s2 } }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Outputting the version number ] | [ Up : Text ] | [ Text: Printing bar numbers with changing regular intervals > ] |
Piano template with centered lyrics
Instead of having a full staff for the melody and lyrics, lyrics can be centered between the staves of a piano staff.
upper = \relative c'' { \clef treble \key c \major \time 4/4 a4 b c d } lower = \relative c { \clef bass \key c \major \time 4/4 a2 c } text = \lyricmode { Aaa Bee Cee Dee } \score { \new PianoStaff << \new Staff = upper { \new Voice = "singer" \upper } \new Lyrics \lyricsto "singer" \text \new Staff = lower { \lower } >> \layout { } \midi { } }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Piano template with centered lyrics ] | [ Up : Text ] | [ Text: Printing marks at the end of a line > ] |
Printing bar numbers with changing regular intervals
The bar number interval can be changed by changing the context function
{set-bar-number-visibility}
.
\relative c' { \override Score.BarNumber.break-visibility = #end-of-line-invisible \context Score \applyContext #(set-bar-number-visibility 4) \repeat unfold 10 c'1 \context Score \applyContext #(set-bar-number-visibility 2) \repeat unfold 10 c }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Printing bar numbers with changing regular intervals ] | [ Up : Text ] | [ Text: Printing marks on every staff > ] |
Printing marks at the end of a line
Marks can be printed at the end of the current line, instead of the beginning of the following line. In such cases, it might be preferable to align the right end of the mark with the bar line.
\relative c'' { g2 c d,2 a' \once \override Score.RehearsalMark.break-visibility = #end-of-line-visible \once \override Score.RehearsalMark.self-alignment-X = #RIGHT \mark "D.C. al Fine" \break g2 b, c1 \bar "||" }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Printing marks at the end of a line ] | [ Up : Text ] | [ Text: Printing text from right to left > ] |
Printing marks on every staff
Although text marks are normally only printed above the topmost staff, they may also be printed on every staff.
\score { << \new Staff { c''1 \mark "molto" c'' } \new Staff { c'1 \mark "molto" c' } >> \layout { \context { \Score \remove "Mark_engraver" \remove "Staff_collecting_engraver" } \context { \Staff \consists "Mark_engraver" \consists "Staff_collecting_engraver" } } }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Printing marks on every staff ] | [ Up : Text ] | [ Text: Putting lyrics inside the staff > ] |
Printing text from right to left
It is possible to print text from right to left in a markup object, as demonstrated here.
{ b1^\markup { \line { i n g i r u m i m u s n o c t e } } f'_\markup { \override #'(text-direction . -1) \line { i n g i r u m i m u s n o c t e } } }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Printing text from right to left ] | [ Up : Text ] | [ Text: Stand-alone two-column markup > ] |
Putting lyrics inside the staff
Lyrics can be moved vertically to place them inside the staff. The
lyrics are moved with \override LyricText.extra-offset = #'(0 .
dy)
and there are similar commands to move the extenders and hyphens.
The offset needed is established with trial and error.
<< \new Staff << \new Voice = "voc" \relative c' { \stemDown a bes c8 b c4 } >> \new Lyrics \with { \override LyricText.extra-offset = #'(0 . 8.6) \override LyricExtender.extra-offset = #'(0 . 8.6) \override LyricHyphen.extra-offset = #'(0 . 8.6) } \lyricsto "voc" { La la -- la __ _ la } >>
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Putting lyrics inside the staff ] | [ Up : Text ] | [ Text: String number extender lines > ] |
Stand-alone two-column markup
Stand-alone text may be arranged in several columns using
\markup
commands:
\markup { \fill-line { \hspace #1 \column { \line { O sacrum convivium } \line { in quo Christus sumitur, } \line { recolitur memoria passionis ejus, } \line { mens impletur gratia, } \line { futurae gloriae nobis pignus datur. } \line { Amen. } } \hspace #2 \column \italic { \line { O sacred feast } \line { in which Christ is received, } \line { the memory of His Passion is renewed, } \line { the mind is filled with grace, } \line { and a pledge of future glory is given to us. } \line { Amen. } } \hspace #1 } }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Stand-alone two-column markup ] | [ Up : Text ] | [ Text: Three-sided box > ] |
String number extender lines
Make an extender line for string number indications, showing that a series of notes is supposed to be played all on the same string.
stringNumberSpanner = #(define-music-function (StringNumber) (string?) #{ \override TextSpanner.style = #'solid \override TextSpanner.font-size = #-5 \override TextSpanner.bound-details.left.stencil-align-dir-y = #CENTER \override TextSpanner.bound-details.left.text = \markup { \circle \number $StringNumber } #}) \relative c { \clef "treble_8" \stringNumberSpanner "5" \textSpannerDown a8\startTextSpan b c d e f\stopTextSpan \stringNumberSpanner "4" g\startTextSpan a bes4 a g2\stopTextSpan }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: String number extender lines ] | [ Up : Text ] | [ Text: UTF-8 > ] |
Three-sided box
This example shows how to add a markup command to get a three sided box around some text (or other markup).
% New command to add a three sided box, with sides north, west and south % Based on the box-stencil command defined in scm/stencil.scm % Note that ";;" is used to comment a line in Scheme #(define-public (NWS-box-stencil stencil thickness padding) "Add a box around STENCIL, producing a new stencil." (let* ((x-ext (interval-widen (ly:stencil-extent stencil X) padding)) (y-ext (interval-widen (ly:stencil-extent stencil Y) padding)) (y-rule (make-filled-box-stencil (cons 0 thickness) y-ext)) (x-rule (make-filled-box-stencil (interval-widen x-ext thickness) (cons 0 thickness)))) ;; (set! stencil (ly:stencil-combine-at-edge stencil X 1 y-rule padding)) (set! stencil (ly:stencil-combine-at-edge stencil X LEFT y-rule padding)) (set! stencil (ly:stencil-combine-at-edge stencil Y UP x-rule 0.0)) (set! stencil (ly:stencil-combine-at-edge stencil Y DOWN x-rule 0.0)) stencil)) % The corresponding markup command, based on the \box command defined % in scm/define-markup-commands.scm #(define-markup-command (NWS-box layout props arg) (markup?) #:properties ((thickness 0.1) (font-size 0) (box-padding 0.2)) "Draw a box round @var{arg}. Looks at @code{thickness}, @code{box-padding} and @code{font-size} properties to determine line thickness and padding around the markup." (let ((pad (* (magstep font-size) box-padding)) (m (interpret-markup layout props arg))) (NWS-box-stencil m thickness pad))) % Test it: \relative c' { c1^\markup { \NWS-box ABCD } c1^\markup { \NWS-box \note {4} #1.0 } }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Three-sided box ] | [ Up : Text ] | [ Text: Vocal ensemble template with lyrics aligned below and above the staves > ] |
UTF-8
Various scripts may be used for texts (like titles and lyrics) by entering them in UTF-8 encoding, and using a Pango based backend. Depending on the fonts installed, this fragment will render Bulgarian (Cyrillic), Hebrew, Japanese and Portuguese.
% Font settings for Cyrillic and Hebrew % Linux Libertine fonts contain Cyrillic and Hebrew glyphs. \paper { #(define fonts (set-global-fonts #:roman "Linux Libertine O,serif" #:sans "Linux Biolinum O,sans-serif" #:typewriter "Linux Libertine Mono O,monospace" )) } % Cyrillic font bulgarian = \lyricmode { Жълтата дюля беше щастлива, че пухът, който цъфна, замръзна като гьон. } hebrew = \lyricmode { זה כיף סתם לשמוע איך תנצח קרפד עץ טוב בגן. } japanese = \lyricmode { いろはにほへど ちりぬるを わがよたれぞ つねならむ うゐのおくや まけふこえて あさきゆめみじ ゑひもせず } % "a legal song to you" portuguese = \lyricmode { à vo -- cê uma can -- ção legal } \relative c' { c2 d e2 f g2 f e1 } \addlyrics { \bulgarian } \addlyrics { \hebrew } \addlyrics { \japanese } \addlyrics { \portuguese }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: UTF-8 ] | [ Up : Text ] | [ Text: Volta text markup using repeatCommands > ] |
Vocal ensemble template with lyrics aligned below and above the staves
This template is basically the same as the simple “Vocal ensemble”
template, with the exception that here all the lyrics lines are placed
using alignAboveContext
and alignBelowContext
.
global = { \key c \major \time 4/4 } sopMusic = \relative c'' { c4 c c8[( b)] c4 } sopWords = \lyricmode { hi hi hi hi } altoMusic = \relative c' { e4 f d e } altoWords = \lyricmode { ha ha ha ha } tenorMusic = \relative c' { g4 a f g } tenorWords = \lyricmode { hu hu hu hu } bassMusic = \relative c { c4 c g c } bassWords = \lyricmode { ho ho ho ho } \score { \new ChoirStaff << \new Staff = "women" << \new Voice = "sopranos" { \voiceOne << \global \sopMusic >> } \new Voice = "altos" { \voiceTwo << \global \altoMusic >> } >> \new Lyrics \with { alignAboveContext = #"women" } \lyricsto "sopranos" \sopWords \new Lyrics \with { alignBelowContext = #"women" } \lyricsto "altos" \altoWords % we could remove the line about this with the line below, since % we want the alto lyrics to be below the alto Voice anyway. % \new Lyrics \lyricsto "altos" \altoWords \new Staff = "men" << \clef bass \new Voice = "tenors" { \voiceOne << \global \tenorMusic >> } \new Voice = "basses" { \voiceTwo << \global \bassMusic >> } >> \new Lyrics \with { alignAboveContext = #"men" } \lyricsto "tenors" \tenorWords \new Lyrics \with { alignBelowContext = #"men" } \lyricsto "basses" \bassWords % again, we could replace the line above this with the line below. % \new Lyrics \lyricsto "basses" \bassWords >> }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Vocal ensemble template with lyrics aligned below and above the staves ] | [ Up : Text ] | [ Vocal music > ] |
Volta text markup using repeatCommands
Though volte are best specified using \repeat volta
, the
context property repeatCommands
must be used in cases where the
volta text needs more advanced formatting with \markup
.
Since repeatCommands
takes a list, the simplest method of
including markup is to use an identifier for the text and embed it in
the command list using the Scheme syntax #(list (list 'volta
textIdentifier))
. Start- and end-repeat commands can be added as
separate list elements:
voltaAdLib = \markup { 1. 2. 3... \text \italic { ad lib. } } \relative c'' { c1 \set Score.repeatCommands = #(list (list 'volta voltaAdLib) 'start-repeat) c4 b d e \set Score.repeatCommands = #'((volta #f) (volta "4.") end-repeat) f1 \set Score.repeatCommands = #'((volta #f)) }
[ << Text ] | [Top][Contents][Index][ ? ] | [ Vocal music >> ] | ||
[ < Text: Vocal ensemble template with lyrics aligned below and above the staves ] | [ Up : Text ] | [ Vocal music > ] |