Of the ubiquity of markup objects: Difference between revisions
Appearance
Import snippet from LSR |
m Replace version="2.24.0" with version="2.24" now that the LilyWiki extension supports auto-selecting the latest release in a stable series |
||
| Line 10: | Line 10: | ||
<code>\markup</code> may additionally be used for lyrics, in chord names, and as dynamics. In fact, it is possible to use <code>\markup</code> to customize the appearance of virtually any object, as demonstrated in this example using various methods. | <code>\markup</code> may additionally be used for lyrics, in chord names, and as dynamics. In fact, it is possible to use <code>\markup</code> to customize the appearance of virtually any object, as demonstrated in this example using various methods. | ||
<lilypond version="2.24 | <lilypond version="2.24" full> | ||
%% Thanks to Aaron Hill https://lists.gnu.org/archive/html/lilypond-user/2019-01/msg00437.html | %% Thanks to Aaron Hill https://lists.gnu.org/archive/html/lilypond-user/2019-01/msg00437.html | ||
Revision as of 18:56, 16 November 2025
Text objects are entered either as simple strings between double quotes or as \markup blocks that can accept a variety of advanced text formatting and graphical enhancements.
As such, markup blocks may be used:
- in any
TextScriptobject (attached to notes with-,^or_), - any
TextMarkintroduced with the\textMarkkeyword, or\textEndMarkcommand, or other similar objects such as MetronomeMark introduced with\tempo, - as standalone markup blocks, entered at the top level outside of any
\scoreblock, - in any definition inside the
\headerblock (e.g. title, subtitle, composer) or in some variables defined inside the\paperblock such asevenHeaderMarkupfor page numbers.
\markup may additionally be used for lyrics, in chord names, and as dynamics. In fact, it is possible to use \markup to customize the appearance of virtually any object, as demonstrated in this example using various methods.
\version "2.24"
%% Thanks to Aaron Hill https://lists.gnu.org/archive/html/lilypond-user/2019-01/msg00437.html
\paper {
paper-width = 8\cm paper-height = 8\cm
}
\header {
title = \markup "Header"
tagline = \markup "(tagline)"
}
\markup "Top-level markup"
dyn = #(make-dynamic-script #{ \markup \text "DynamicText" #})
\score {
<<
\new ChordNames
\with { majorSevenSymbol = \markup "majorSevenSymbol" }
\chordmode { c1:maj7 }
\new Staff {
\tempo \markup "MetronomeMark"
\textMark "TextMark"
\once \override TupletNumber.text = \markup "TupletNumber"
\tuplet 3/2 {
\once \override NoteHead.stencil = #ly:text-interface::print
\once \override NoteHead.text = \markup \lower #0.5 "NoteHead"
c''8^\markup "TextScript"
\once \override Rest.stencil = #(lambda (grob)
(grob-interpret-markup grob #{
\markup "Rest"
#}))
r4
}
}
\new Lyrics \lyricmode { \markup "LyricText" 1 }
\new Dynamics { s1\dyn }
>>
}