lilypond-user
[Top][All Lists]
Advanced

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

Re: Help on staves layout and repeat bars


From: Thomas Morley
Subject: Re: Help on staves layout and repeat bars
Date: Mon, 8 Oct 2012 16:31:07 +0200

2012/10/8 Dominique Faure <address@hidden>:
> Hi,
>
> I wanted to get grouped staves bound together on line endings, with
> repeat bars being the solely bars drawn through all the staves.
> The following code address the first requirement as expected, but how
> could I handle the repeat bars?
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> \version "2.16.0"
>
> notes = \relative c' {
>   r1 r1
>   \repeat volta 2 { r1 r1 }
>   \repeat volta 2 { r1 r1 }
>   r1 r1
> }
>
> \score {
>   \new StaffGroup <<
>     \new Staff { \notes }
>     \new Staff { \notes }
>   >>
>   \layout {
>     \override Score.SpanBar #'break-visibility = #center-invisible
>     % ...also hide the repeat bar span
>
>     ragged-right = ##t
>   }
> }
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
>
> --
> Dominique
>
> _______________________________________________
> lilypond-user mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/lilypond-user

Hi,

try:

\version "2.16.0"

#(define span-bars-to-print '(".|" "|." ".|."))

hideSomeSpanBars =
\override Score.SpanBar #'after-line-breaking =
  #(lambda (grob)
    (let ((glyph-name (ly:grob-property grob 'glyph-name)))
    ;;(newline)(display glyph-name)
    (if (and (ly:item? grob)
             (not (member glyph-name span-bars-to-print))
             (not (equal? (ly:item-break-dir grob) LEFT)))
        (ly:grob-suicide! grob)
        #f)))

notes = \relative c' {
  r1 r1
  \repeat volta 2 { r1 r1 }
  \break
  \repeat volta 2 { r1 r1 }
  r1 r1
}

\score {
  \new StaffGroup <<
    \new Staff { \notes }
    \new Staff { \notes }
  >>
  \layout {
    \context {
            \Score
            \hideSomeSpanBars
    }
    ragged-right = ##t
  }
}

If you want other SpanBars to be printed, just update the list defined
as span-bars-to-print .


HTH,
  Harm



reply via email to

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