Of the ubiquity of markup objects: Difference between revisions

Import snippet from LSR
 
mNo edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Text objects are entered either as simple strings between double quotes or as <code>\markup</code> blocks that can accept a variety of advanced text formatting and graphical enhancements.
Text objects are entered either as simple strings between double quotes or as <code>\markup</code> blocks that can accept a variety of advanced text formatting and graphical enhancements.


As such, markup blocks may be used:
As such, markup blocks may be used


* in any <code>TextScript</code> object (attached to notes with <code>-</code>, <code>^</code> or <code>_</code>),
* in any <code>TextScript</code> object (attached to notes with <code>-</code>, <code>^</code>, or <code>_</code>);
* any <code>TextMark</code> introduced with the <code>\textMark</code> keyword, or <code>\textEndMark</code> command, or other similar objects such as MetronomeMark introduced with <code>\tempo</code>,
* in any <code>TextMark</code> introduced with the <code>\textMark</code> keyword, or <code>\textEndMark</code> command, or other similar objects such as <code>MetronomeMark</code> introduced with <code>\tempo</code>;
* as standalone markup blocks, entered at the top level outside of any <code>\score</code> block,
* as standalone markup blocks, entered at the top level outside of any <code>\score</code> block;
* in any definition inside the <code>\header</code> block (e.g. title, subtitle, composer) or in some variables defined inside the <code>\paper</code> block such as <code>evenHeaderMarkup</code> for page numbers.
* in any definition inside the <code>\header</code> block (e.g., title, subtitle, composer) or in some variables defined inside the <code>\paper</code> block such as <code>evenHeaderMarkup</code> for page numbers.


<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.0" full>
<lilypond version="2.24" full>
%% Thanks to Aaron Hill https://lists.gnu.org/archive/html/lilypond-user/2019-01/msg00437.html
% LSR Thanks to Aaron Hill
% LSR https://lists.gnu.org/archive/html/lilypond-user/2019-01/msg00437.html


\paper {
\paper {
   paper-width = 8\cm paper-height = 8\cm
   paper-width = 8\cm
  paper-height = 8\cm
}
}


\header {
\header {
   title = \markup "Header"
   title = \markup "Title"
   tagline = \markup "(tagline)"
   tagline = \markup "(tagline)"
}
}
Line 26: Line 28:
dyn = #(make-dynamic-script #{ \markup \text "DynamicText" #})
dyn = #(make-dynamic-script #{ \markup \text "DynamicText" #})


\score {
<<
  <<
  \new ChordNames \with {
    \new ChordNames
    majorSevenSymbol = \markup "majorSevenSymbol"
    \with { majorSevenSymbol = \markup "majorSevenSymbol" }
  } \chordmode { c1:maj7 }
    \chordmode { c1:maj7 }
 
    \new Staff {
  \new Staff {
      \tempo \markup "MetronomeMark"
    \tempo \markup "MetronomeMark"
      \textMark "TextMark"
    \textMark \markup "TextMark"
      \once \override TupletNumber.text = \markup "TupletNumber"
 
    \once \override TupletNumber.text = \markup "TupletNumber"
       \tuplet 3/2 {
       \tuplet 3/2 {
         \once \override NoteHead.stencil = #ly:text-interface::print
         \once \override NoteHead.stencil = #ly:text-interface::print
         \once \override NoteHead.text = \markup \lower #0.5 "NoteHead"
         \once \override NoteHead.text = \markup \lower #0.5 "NoteHead"
         c''8^\markup "TextScript"
         c''8^\markup "TextScript"
         \once \override Rest.stencil = #(lambda (grob)
         \once \override Rest.stencil = #(lambda (grob)
           (grob-interpret-markup grob #{
           (grob-interpret-markup grob #{ \markup  "Rest" #}))
            \markup  "Rest"
            #}))
         r4
         r4
       }
       }
    }
  }
    \new Lyrics \lyricmode { \markup "LyricText" 1 }
  \new Lyrics \lyricmode { \markup "LyricText" 1 }
    \new Dynamics { s1\dyn }
  \new Dynamics { s1\dyn }
  >>
>>
}
</lilypond>
</lilypond>


[[Category:Text]]
[[Category:Text]]
[[Category:Included in the official documentation]]
[[Category:Included in the official documentation]]
[[Category:Snippet]]