Thanks a lot Thmas for this quick answer !

 

Unfortunatly, I forgot to say that I use the 2.16.2 version of lilypond. So I 
changed your function this way, but I have an "Unbound variable grob::name" 
error...

Can you still help me ?

Thanks a lot,

Rémy



my-bar-short-instrument-name =

\with {

instrumentName = "1"

shortInstrumentName = ""

\override InstrumentName #'after-line-breaking =

#(lambda (grob)

(let* ((all-sys-elts (ly:grob-object (ly:grob-system grob) 'all-elements))

(sorted-bar-nmbrs

(sort

(map

(lambda (g)

(markup->string (ly:grob-property g 'text)))

(filter

(lambda (e)

(eq? (grob::name e) 'BarNumber))

(ly:grob-array->list

(ly:grob-object (ly:grob-system grob) 'all-elements))))

string-ci<?)))

(if (and (not (null? sorted-bar-nmbrs)) (not (null? all-sys-elts)))

(ly:grob-set-property! grob 'text

(car sorted-bar-nmbrs)))))

}

 

 

 

 

> Message du 24/02/16 12:03
> De : "Thomas Morley" 
> A : "Remy CLAVERIE" 
> Copie à : "lilypond-user" 

> Objet : Re: BarNumber instead of shortInstrumentName
> 
> 2016-02-24 10:05 GMT+01:00 Remy CLAVERIE :
> > Dear lilypond users,
> >
> >
> >
> > I would like to place BarNumbers at the right side of a StaffGroup, but I do
> > not see how to do that. I frist used the X/Y-offset properties but it was
> > not a good idea because the distance between staves of a StaffGroup is
> > flexible; so numbers were never really horizontally centered.
> >
> >
> >
> > My new idea is to use the shortInstrumentName of the StaffGroup context, but
> > I don't know how to read/get the bar number from the stencil properties and
> > then convert it into the shortInstrumentName string.
> >
> >
> >
> > Can someone help me ?
> >
> >
> >
> > Thanks a lot !
> >
> >
> >
> > Rémy
> 
> 
> How about
> 
> \version "2.19.36"
> 
> \layout {
> \hide Score.BarNumber
> }
> 
> my-bar-short-instrument-name =
> \with {
> instrumentName = "1"
> shortInstrumentName = ""
> \override InstrumentName.after-line-breaking =
> #(lambda (grob)
> (let* ((all-sys-elts (ly:grob-object (ly:grob-system grob) 'all-elements))
> (sorted-bar-nmbrs
> (sort
> (map
> (lambda (g)
> (markup->string (ly:grob-property g 'text)))
> (filter
> (lambda (e)
> (eq? (grob::name e) 'BarNumber))
> (ly:grob-array->list
> (ly:grob-object (ly:grob-system grob) 'all-elements))))
> string-ci<?)))
> (if (and (not (null? sorted-bar-nmbrs)) (not (null? all-sys-elts)))
> (ly:grob-set-property! grob 'text
> (car sorted-bar-nmbrs)))))
> }
> 
> \new Staff \my-bar-short-instrument-name
> \repeat unfold 20 {
> \time 4/4
> c'1
> \time 3/4 d'2 e'4
> \time 2/8 f'4 g'8[ a']
> }
> 
> HTH,
> Harm
>
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to