lilypond-user
[Top][All Lists]
Advanced

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

Colouring grobs with \ed function and disappearing bar


From: Gianmaria Lari
Subject: Colouring grobs with \ed function and disappearing bar
Date: Wed, 20 Sep 2017 10:53:03 +0200

This code works as expected generating two anacrusis measures c4 | 42 (see attached image).

\version "2.19.65"
\fixed c'' {
  \partial 4 c4 
  \partial 2. c2. 
}

Now I would like to make the same but with second measure grey. I use \ed function at

http://lsr.di.unimi.it/LSR/Item?id=985

and here it is the new code (at the end of this message I included the complete code):

\version "2.19.65"
\fixed c'' {
  \partial 4 c4 
  \partial 2. \ed Note {c2. }
}

This code unfortunately does not work as expected (expected to me :)) because the separator bar between c4 and c2 now has disappeared. How can I fix it?

* * * 
\version "2.19.65"

editorsColor = #grey
ed =
#(define-music-function (parser location grob col mus)
   (symbol-list-or-symbol? (color? editorsColor) ly:music?)
   ;; for abbreviations, we need a symbol instead of a one-element list
   (let ((grob (if (= 1 (length grob)) (car grob) grob)))
     (case
      grob
      ;; define abbreviations
      ;; which call the function recursively with a value
      ;; leading into the (else) clause
      ;; (or to _another_ abbreviation)
      ;; be careful to avoid infinite recursion :-)
      ;; – abbreviation names must not be actual grob names
      ;; (at least if they’re used in the corresponding
      ;; clause) or recursion will be infinite also
      ;; It is recommended to use singular forms only
      ;; for abbreviations.
      ((Caut) #{ \ed Staff.AccidentalCautionary #})
      ((LedgerLine) #{ % barline is workaround to issue 3949
        \once\hide Staff.BarLine \bar "|"
        \stopStaff
        \ed Staff.LedgerLineSpanner {
          \startStaff
          $mus
          \stopStaff
        }
        \once\hide Staff.BarLine \bar "|"
        \startStaff #})
      ((Mmr) #{ \ed MultiMeasureRest $mus #})
      ((Note) #{ \ed Staff.Accidental
                 \ed Beam
                 \ed Dots
                 \ed Flag
                 \ed LedgerLine
                 \ed NoteHead
                 \ed Rest
                 \ed Stem $mus #})
      ((Pitch) #{ \ed NoteHead $mus #})
      ((Suggest) #{ \ed Staff.AccidentalSuggestion #})
      ((StemWithFlag) #{ \ed Stem \ed Flag $mus #})
      ((Tuplet) #{ \ed TupletNumber \ed TupletBracket $mus #})
      ;; ‘normal’ case
      (else
       #{
         \override $grob . color = #col
         $mus
         \revert $grob . color
       #}))))

\fixed c'' {
  \partial 4 c4 
  \partial 2. \ed Note {c2. }
}

Attachment: Capture.PNG
Description: PNG image


reply via email to

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