\version "2.18.2"

#(define-markup-command (overlay layout props args)
  (markup-list?)
  #:category align
  "
@cindex merging text

Takes a list of markups combining them.

@lilypond[verbatim,quote]
\\markup {
  \\fontsize #5
  \\override #'(thickness . 2)
  \\overlay {
    \\draw-line #'(0 . 4)
    \\arrow-head #Y #DOWN ##f
    \\translate #'(0 . 4)\\arrow-head #Y #UP ##f
  }
}
@end lilypond"
  (apply ly:stencil-add (interpret-markup-list layout props args)))

  
squiggle =
#(define-markup-command (squiggle layout props wd ht rep )
   (number? number? number?)
   #:category graphic
   #:properties ((thickness 2))
   (let* ((th (* (ly:output-def-lookup layout 'line-thickness) thickness))
          (x 0)
          (step (* wd 0.5))
          (strht (number->string ht))
          (strps (string-append (number->string th) " setlinewidth "
                   "0 0 moveto " 
                   (number->string (* step 1)) " " strht " "
                   (number->string (* step 2)) " " strht " "
                   (number->string (* step 3)) " 0 curveto "
                   (number->string (* step 3)) " 0 moveto " 
                   (number->string (* step 4)) " -" strht " "
                   (number->string (* step 5)) " -" strht " "
                   (number->string (* step 6)) " 0 curveto stroke"  )))
     (interpret-markup layout props (markup #:pattern rep X (* 3 wd) 
                                      #:postscript strps #:hspace (* 3 wd)))))



music = \relative c'' {  
  \set Staff.explicitClefVisibility = #all-invisible
  
   \override Staff.TimeSignature.stencil = #'()
  \override Staff.BarLine.transparent = ##t  
  \override TextScript.padding = #1.5 
  f^\markup \squiggle #0.3 #0.3 #4 
}
\markup {
  %\vspace #YSpace
  \overlay {
    \translate #(cons 0 0) \halign #LEFT \score {
      \new Staff \with {fontSize = #-2
        \override StaffSymbol #'staff-space = #(magstep -2)
        \override StaffSymbol #'thickness = #(magstep -2)} <<       
        \new Voice = "s" <<
          \music
        >>
      >>
      \layout {line-width = 20}
    }     
\translate #(cons 20 0) \halign #LEFT "Tremolo"
  }
}

music = \relative c'' {  
  \set Staff.explicitClefVisibility = #all-invisible
   \override Staff.TimeSignature.stencil = #'()
  \override Staff.BarLine.transparent = ##t 
\once \override TextScript.extra-offset = #'(3 . -3)
bes4->\!^\markup \squiggle #0.8 #0.7 #3 \once \hideNotes <\tweak #'X-offset #5 bes>2
}
\markup {
  %\vspace %#YSpace
  \overlay {
    \translate #(cons 0 0) \halign #LEFT \score {
      \new Staff \with {fontSize = #-2
        \override StaffSymbol #'staff-space = #(magstep -2)
        \override StaffSymbol #'thickness = #(magstep -2)} <<       
        \new Voice = "s" <<
          \music
        >>
      >>
      \layout {line-width = 20}
    }     
\translate #(cons 20 0) \halign #LEFT \column {"Tondauer verlängern durch" 
                                               "Repetition oder ruhiges Vibrato"}
  }
}


