2014-05-21 11:24 GMT+02:00 Urs Liska <[email protected]>:

> for analysis purposes I'd like to draw (e.g.) boxes around objects on
> different staves (see attachment).
> Is there a straightforward and particularly robust way to do that with
> LilyPond itself (the image was postprocessed)?
>
>
Hi Urs,
I have nothing miraculous nor elegant but I think that two half boxes offer
some flexibility (if that could bring some inspiration).
See enclosed.
HTH,
Pierre
\version "2.18.2"

halfBoxUp = {
  \once\override TextSpanner.style = #'line
  \once\override TextSpanner.thickness = #2
  \once\override TextSpanner.to-barline = ##t
  \once\override TextSpanner.bound-details =
            #`((left
                (text . ,#{ \markup {
                  \override #'(thickness . 2)
		  \draw-line #'(0 . -9) 
                  } #})
                (Y . 0)
                (padding . -1.5))
               (right
                (text . ,#{ \markup { 
	          \override #'(thickness . 2)
	          \draw-line #'(0 . -9) } #})
                (Y . 0)
                (padding . -1.5)))
}

halfBoxDown = {
  \once\textSpannerDown
  \once\override TextSpanner.style = #'line
  \once\override TextSpanner.thickness = #2
  \once\override TextSpanner.to-barline = ##t
  \once\override TextSpanner.bound-details =
            #`((left
                (text . ,#{ \markup {
                  \override #'(thickness . 2)
		  \draw-line #'(0 . 9) 
                  } #})
                (Y . 0)
                (padding . -1.5))
               (right
                (text . ,#{ \markup { 
	          \override #'(thickness . 2)
	          \draw-line #'(0 . 9) } #})
                (Y . 0)
                (padding . -1.5)))
}

<<
  \new Staff 
  \relative c'' {
    c4 \halfBoxUp
    c8*2 -\tweak #'extra-offset #'(0 . -8) % this tweak to set half box joints if needed
    \startTextSpan  c  \stopTextSpan c4  |
  }
  \new Staff
  \relative c' {
    c4 \halfBoxDown
    c -\tweak #'extra-offset #'(0 . 8) % this tweak to set half box joints if needed
    \startTextSpan c \stopTextSpan c  |
  } 
>>
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to