lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Variables in instrumentName markup?


From: Thomas Morley
Subject: Re: Variables in instrumentName markup?
Date: Sat, 28 Mar 2015 21:20:54 +0100

2015-03-28 20:27 GMT+01:00 Mark Knoop <address@hidden>:
> At 14:13 on 28 Mar 2015, Trevor Bača wrote:
>>Hi,
>>
>>Is there a way to do ...
>>
>>   foo = #12
>>   \new Staff \with {
>>      instrumentName = \markup { \hcenter-in \foo Percussion }
>>   } { ... }
>>   \new Staff \with {
>>      instrumentName = \markup { \hcenter-in \foo Violin }
>>   } { ... }
>>
>>... or equivalent?
>
> Just write #foo. Or even #(+ foo 3), #(/ foo 2.735), ....
>
> --
> Mark Knoop



How about:

\version "2.19.17"

val = 12

\layout {
    \context {
    \Staff
    \override InstrumentName.after-line-breaking =
    #(lambda (grob)
      (ly:grob-set-property! grob 'long-text
        (markup
          #:box ;; only for debugging, delete me
          #:hcenter-in val
          (ly:grob-property grob 'long-text))))
    }
}

   \new Staff
   \with { instrumentName = "Percussion" }
   { c''1 }
   \new Staff
   \with { instrumentName = "Violin" }
   { d''1 }


HTH,
  Harm



reply via email to

[Prev in Thread] Current Thread [Next in Thread]