2012/11/1 Olivier Biot <olivier.b...@gmail.com>:
> Hi all,
>
> Is there a way to display and increment bar numbers only after a double bar?
[...]

Hi Olivier,

why not use RehearsalMark?

\version "2.17.5"

barMark = { \bar "||" \mark \default }

\relative c' {
        \set Score.markFormatter = #format-mark-circle-numbers
        c1      
        \barMark
        e
        f
        \barMark
        \break
        g
}

A function is possible, too:

\version "2.17.5"

doubleBarMark =
#(define-music-function (parser location music) (ly:music?)
  (music-map (lambda (m)
    (if (eq? 'ContextSpeccedMusic (ly:music-property m 'name))
      (let* ((elt (ly:music-property m 'element))
             (prop-set (ly:music-property elt 'name))
             (value (ly:music-property elt 'value))
             (symbol (ly:music-property elt 'symbol)))

        (if (and (eq? prop-set 'PropertySet) ;; needed?
                 (equal? value "||")
                 (eq? symbol 'whichBar)) ;; needed?
          (set! m (make-sequential-music
                     (list (make-music
                             'SequentialMusic
                             'elements
                             (list
                               m
                               (make-music
                                 'MarkEvent
                                 'label '() )))))))))
  m)
  music))

%------- test

mus =
\relative c' {
        \doubleBarMark {
        c1      
        \bar "||"
        e
        f
        \bar "||"
        \break
        g
        }
}

musII =
    \relative d' {
      \key d \minor
      \clef bass
      \time 3/8
      \bar "||"
      a16-.-\upbow b (c) d(c) b (
      a) b (c) d(c) b-\laissezVibrer \bar "||"
      a16 (b) c(d) c(b)
      a (b c d c) b-. \bar "||"
      a b c d c b
      a (b c d) c (b) \bar "||"
      a (b) c-. d-. c b
      a16 (b) c(d) c(b)
      a (b c d c) b-. \bar "||"
      a b c d c b
      a (b c d) c (b) \bar "||"
      a (b) c-. d-. c b
    }

\score {
  \new StaffGroup <<
    \new Staff \doubleBarMark \musII
    \new Staff \doubleBarMark \musII
  >>
  \layout {
     \context {
             \Score
             markFormatter = #format-mark-circle-numbers
             \override BarNumber #'stencil = #point-stencil
             %\override RehearsalMark #'X-extent = #'(0 . 0)
             \override RehearsalMark #'break-align-symbols =
                #'(staff-bar time-signature key-signature clef left-edge)
     }
     \context {
             \Staff
             \remove "Time_signature_engraver"
             \remove "Clef_engraver"
             \remove "Key_engraver"
     }
  }
}



HTH,
  Harm

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

Reply via email to