I wonder whether any of you Lilypond wizards could help me work out how to improve my Lilypond scores. Most of my embellishments come from reading/copying bits of code from this forum - but I admit I don't always fully understand why things work. However, I have this 'snippet' which I call "Markup anywhere", which basically allows a markup to be added without disrupting any of the positioning of other items. What I would like is to know how it can be improved - so that I can use it without copying large chunks of code whenever it is required. The amended markup is demonstrated here:-
c1^\markup { \null \with-dimensions #'(0 . 0) #'(0 . 0) \translate #'(-10.0 . -4.0) \override #'(font-name ."Tahoma bold italic") \fontsize #-2 \with-color #(x11-color "LimeGreen") \box \box \whiteout "Put your text here" Could this be streamlined and generalised somehow, and yet still be able to accept various variable to alter position/colour etc I've attached a lilypond file which demonstrates what I mean. Just as a side note - why does the \whiteout not work perfectly? Thank you for reading this and I appreciate any thoughts, amendments, and suggestions. Colin Baguley
\version "2.22.1" \header { title = "Please improve this" } global = { \time 4/4 \key c \major } melody = \relative c'' { \global c4 d e f^\markup { \null \with-dimensions #'(0 . 0) #'(0 . 0) \translate #'(-10.0 . -4.0) % LEFT/RIGHT UP/DOWN \override #'(font-name ."Tahoma bold italic") \fontsize #-2 \with-color #(x11-color "LimeGreen") \box \box \whiteout "This markup can be placed anywhere without affecting any other placement" } | g f e d | c b a2 | c4 d e f | g f e d | c b a2^\markup { \null \with-dimensions #'(0 . 0) #'(0 . 0) \translate #'(0.0 . -4.5) % LEFT/RIGHT UP/DOWN \override #'(font-name ."Tahoma bold italic") \fontsize #-2 \with-color #(x11-color "red") \box \whiteout "But I'm sure the code be improved - and yet still allow variables in position/colour etc" } c4 d e f | g f e d | c b a2 c4 d e f | g f e d c^\markup { \null \with-dimensions #'(0 . 0) #'(0 . 0) \translate #'(-10.0 . -6.0) % LEFT/RIGHT UP/DOWN \override #'(font-name ."Tahoma bold italic") \fontsize #-2 \with-color #(x11-color "Blue") \whiteout "you can see I'm copy & pasting big chunks of code, and altering it a bit"} b a2 c4 d e f | g f e d | c_\markup {\italic \bold \box {\column { \line {an ordinary markup} \line {pushes my lyric line} \line {down} } } } b a2 c4 d e^\markup { \null \with-dimensions #'(0 . 0) #'(0 . 0) \translate #'(-10.0 . -8.0) % LEFT/RIGHT UP/DOWN \override #'(font-name ."Tahoma bold italic") \fontsize #-2 \with-color #(x11-color "brown") \whiteout "but this allows me to put odd comments in without moving anything else"} \f f, \p g f e d | c \ff b \ppp a2 } words = \lyricmode { \repeat unfold 6 { one two three four five six se -- ven eight nine ten} } \score { << \new Staff { \melody } \addlyrics { \words } >> \layout { } }