Hi,

I didn't look into it, but when _I_ asked this question I got the attachment as a result.

HTH
Urs

Am 11.11.2013 23:08, schrieb Kieren MacMillan:
Hello all,

Consider the following snippet:

\version "2.17.29"

global = {
   \time 3/4
   s4*3
}
notes = {
   c'1.
}

\score {
   \new Staff \repeat "unfold" 3 { << \global \notes >> }
}

This is contrived, of course, but I run into it a lot when I “stitch together” 
pre-existing variables (which include time signatures) into a medley, etc.
Is there a global setting that I can use — analogous to the chordChanges switch 
in ChordNames — so that time signatures only appear if they change?

Thanks,
Kieren.
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

%{
   Engraver that suppresses the printing of a
   time signature if it is the same that is 
   currently in effect.
   
   Author: David Nalesnik
   http://www.mail-archive.com/[email protected]/msg72628.html
   
   This is actually a work-around to an unwanted behaviour, see
   http://lists.gnu.org/archive/html/lilypond-user/2013-04/msg00851.html and
   https://lists.gnu.org/archive/html/bug-lilypond/2013-04/msg00162.html
%}

\version "2.14.2"

suppressRedundantTimeSig =
#(lambda (ctx)
  (let ((time-sig '()))

   `((acknowledgers
      (time-signature-interface
       . ,(lambda (engraver grob source-engraver)
           (set! time-sig (cons grob time-sig)))))

     (finalize
      . ,(lambda (trans)
          (reduce
            (lambda (elem prev)
              (if (equal? (ly:grob-property elem 'fraction)
                          (ly:grob-property prev 'fraction))
                  (begin
                    (ly:grob-suicide! elem)
                    prev)
                  elem))
              '()
              (reverse time-sig))
            (set! time-sig '()))))))

%{ Usage:
 
 music = {
   \time 3/4
  R2.
  \time 4/4
  R1
  \time 4/4
  R1
  \time 3/4
  R2.
}

\score {
  \new Staff \music

  \layout {
    \context {
      \Score
      \consists #suppressRedundantTimeSig
    }
  }
}

%}
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to