lilypond-user
[Top][All Lists]
Advanced

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

Re: Minimal space between barline and next object


From: David Nalesnik
Subject: Re: Minimal space between barline and next object
Date: Fri, 27 Jan 2012 08:02:38 -0600

Hi Nils,

2012/1/27 Janek Warchoł <address@hidden>
Hi Nils,

2012/1/27 Nils <address@hidden>:
> 1) Can I ask instruct Lilypond globally for minimal space after a barline? Not an overall, relative increas. I don't want notes with accidentals to move further away, they are perfect.


You could do this:

\override Staff.BarLine #'extra-spacing-width = #'(0 . 1)

But this will affect all first notes, whether having an accidental or not.

I'm new to the Scheme engraver thing, but I've written one which appears to work, at least with my minimal example.  Basically, it finds the first note-column in a measure and adds extra space to the preceding bar line if there is no accidental.  (It will also add space if there is a rest there, but that could be easily fixed if it's a problem.)

\version "2.15.26"

addSpace =
#(lambda (context)
   (let ((bar-line '())
         (accidental #f)
         (note-column '()))
         
   `((acknowledgers
       (bar-line-interface
         . ,(lambda (engraver grob source-engraver)
              (set! bar-line grob)))
              
       (accidental-interface
         . ,(lambda (engraver grob source-engraver)
              (set! accidental #t)))
              
       (note-column-interface
         . ,(lambda (engraver grob source-engraver)
              (set! note-column grob))))
               
     (stop-translation-timestep
       . ,(lambda (trans)
            (if (null? bar-line)
                '()
                (if (not accidental)
                    (set! (ly:grob-property bar-line 'extra-spacing-width) '(0 . 1))))
            (set! bar-line '())
            (set! accidental #f))))))
            
\layout {
  \context {
    \Staff
    \consists #addSpace
  }
}
   
\relative c'' {
  c c c c
  cis cis cis cis
  <c e f> c c c
  cis cis cis cis
  c c c c
}

I hope this helps!  If anyone more experienced with this sort of thing has comments/suggestions, please let me know how I can improve this.

-David



reply via email to

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