Re: Variables in instrumentName markup?

2015-03-29 Thread Trevor Bača
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 
wrote:

> 2015-03-28 20:27 GMT+01:00 Mark Knoop :
> > 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
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>



-- 
Trevor Bača
trevorb...@gmail.com
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Variables in instrumentName markup?

2015-03-28 Thread Thomas Morley
2015-03-28 20:27 GMT+01:00 Mark Knoop :
> 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
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Variables in instrumentName markup?

2015-03-28 Thread Mark Knoop
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

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Variables in instrumentName markup?

2015-03-28 Thread Trevor Bača
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?

(The motivation being to use the same amount of horizontal space in a
couple of dozen different instrument names.)

Trevor.

-- 
Trevor Bača
trevorb...@gmail.com
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user