lilypond-user
[Top][All Lists]
Advanced

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

Re: Variables in instrumentName markup?


From: Trevor Bača
Subject: Re: Variables in instrumentName markup?
Date: Sun, 29 Mar 2015 08:24:52 -0400

Hi Mark & hi Harm,

Brilliant. Just what I was looking for, and instructive in two different ways.

Thank you both.

Trevor.

On Sat, Mar 28, 2015 at 4:20 PM, Thomas Morley <address@hidden> wrote:
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

_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user



--
Trevor Bača
address@hidden

reply via email to

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