Hi Kevin,

> I have two questions about this snippet:

You forgot to include the snippet or a link! :)
But I assume you mean 
https://lilypond.org/doc/v2.25/Documentation/snippets/vocal-music_003a-adding-indicators-to-staves-which-get-split-after-a-break

> The easy question. The fourth line of the snippet reads:
>    (PI_OVER_180 (/ (atan2 1 1) 34))
> Surely that “34” should be “45”.

Did you try changing it?  ;)

> The more difficult question. This snippet adds two arrows to the bar line at 
> the end of the staff. I have a case where there is a key change at the end of 
> the staff where I'd like to put the indicator, and so the bar line is not at 
> the end of the staff. The snippet dutifully adds arrows to the bar line, 
> which conflict with the new key signature. Is there a way to move the arrows 
> to the end of the staff, rather than on the bar line?

I have a modified version (included below) which handles TimeSignature — you 
can likely adjust it to handle KeySignature as you want it to!

Hope this helps!
Kieren.

p.s. It would be amazing if this were more automatic (i.e., it handled all 
possible end-of-staff grobs/situations), adjustable (e.g., had parameters for 
arrow angle, padding, etc.), and built into Lilypond basecode — I just don’t 
have time to climb the various learning curves and put together a patch 
currently.  :(
_____________________________________

%%%%  SNIPPET BEGINS
\version "2.25.11"

\layout {
  \context {
    \Score
    \remove Bar_number_engraver
  }
}

#(define-markup-command (arrow-at-angle layout props angle length fill)
  (number? number? boolean?)
  (ly:stencil-rotate
    (interpret-markup layout props
      (markup #:concat (#:draw-line (cons length 0)
                        #:hspace -0.1
                        #:arrow-head X RIGHT fill)))
    angle -1 0))

arrowUpMarkup = \markup \concat { \hspace #0.375 \override #'(thickness . 1.5) 
\arrow-at-angle #30 #(sqrt 4) ##t }
arrowDownMarkup = \markup \concat { \hspace #0.375 \override #'(thickness . 
1.5) \arrow-at-angle #-30 #(sqrt 4) ##t }

staffSplitMarkup =
\markup
  \with-dimensions #'(0 . 0) #'(0 . 0)
  \combine
    \raise #0.4 \arrowUpMarkup
    \lower #0.4 \arrowDownMarkup

staffSplit = #(define-music-function (grob-name) (string?)
  #{ { \once \override Staff.$grob-name #'stencil =
          #(grob-transformer 'stencil (lambda (grob orig)
            (if (= LEFT (ly:item-break-dir grob))
              (ly:stencil-combine-at-edge
                orig X RIGHT
                (grob-interpret-markup grob staffSplitMarkup)
                (if (equal? "TimeSignature" grob-name) 0.5 0))
              orig)))
        \break } #} )

staffConvergeDown = #(define-music-function (grob-name) (string?)
  #{ { \once \override Staff.$grob-name #'stencil =
          #(grob-transformer 'stencil (lambda (grob orig)
            (if (= LEFT (ly:item-break-dir grob))
              (ly:stencil-combine-at-edge
                orig X RIGHT
                (grob-interpret-markup grob #{
                  \markup
                    \with-dimensions #'(0 . 0) #'(0 . 0)
                    \arrowDownMarkup #})
                (if (equal? "TimeSignature" grob-name) 0.5 0))
              orig)))
        \break } #} )

staffConvergeUp = #(define-music-function (grob-name) (string?)
  #{ { \once \override Staff.$grob-name #'stencil =
          #(grob-transformer 'stencil (lambda (grob orig)
            (if (= LEFT (ly:item-break-dir grob))
              (ly:stencil-combine-at-edge
                orig X RIGHT
                (grob-interpret-markup grob #{
                  \markup
                    \with-dimensions #'(0 . 0) #'(0 . 0)
                    \arrowUpMarkup #})
                (if (equal? "TimeSignature" grob-name) 0.5 0))
              orig)))
        \break } #} )


upper = {
  c'1 \break
  c'1 \staffConvergeDown "BarLine" \break
  c'1 \staffConvergeDown "TimeSignature" \time 3/2 \break
  c'1.
}

lower = {
  c'1 \break
  c'1 \staffConvergeUp "BarLine" \break
  c'1 \staffConvergeUp "TimeSignature" \break
  c'1. \break
}

\new ChoirStaff <<
  \new Staff \upper
  \new Staff \lower
>>
%%%%  SNIPPET ENDS
______________________________________________

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.


Reply via email to