Hello Ahanu,

the cleanest way would be if this was fixed in code, but else instead of your 
<< ... >> constructs it suffices to do

\version "2.24.0"
\language "english"
{ 
  g8 \new Voice <>^\upbow g_\upbow g g
}

In fact we can use a little music function to get this done really 
beautifully:

sep =
#(define-music-function (m) (ly:music?)
   #{
     \new Voice <>-$m
   #})

\version "2.24.0"
\language "english"
{
  g8 \sep^\upbow g_\upbow g g
}

But this way of doing this has a little drawback: Positioning will not avoid 
collision with other notes. This can be solved by using an engraver to 
equalise side support elements between such grobs, as shown in the appended 
file.

Cheers,
Valentin

Am Mittwoch, 1. Februar 2023, 03:21:42 CET schrieb Ahanu Banerjee:
> I'm trying to put the same articulation both above and below one note. (My
> document has one set of bowings above the staff and an alternate set below
> the staff, and occasionally they both need the same marking.)
> 
> The workaround I currently have is creating a second voice, which is a bit
> of a pain. Are there better solutions? Code below.
> 
> \version "2.24.0"
> \language "english"
> { g8 g_\upbow ^\upbow g g % fails
>   g8 g_\upbow ^\downbow g g % works
>   % desired output:
>   << { g8 g_\upbow g g } \\ { s s ^\upbow } >> }
> 
> Thanks,
> -Ahanu

#(define (equalise-articulations-engraver context)
   (let ((scripts '()))
      (make-engraver
       (acknowledgers
        ((script-interface eng grob source-eng)
         (let* ((cause (ly:grob-property grob 'cause))
                (type (ly:event-property cause 'articulation-type))
                (prev (assoc-get type scripts '())))
           (set! scripts (assoc-set! scripts type (cons grob prev))))
         ))
       ((process-acknowledged engraver)
        (for-each
         (lambda (x)
           (let* ((grobs (cdr x))
                  (side-supports (map (lambda (grob) (ly:grob-object grob 'side-support-elements)) grobs))
                  (side-supports (filter ly:grob-array? side-supports))
                  (side-supports (map ly:grob-array->list side-supports))
                  (side-supports (apply append side-supports))
                  (side-supports (ly:grob-list->grob-array side-supports)))
             (for-each
              (lambda (y) (ly:grob-set-object! y 'side-support-elements side-supports))
              grobs)))
         scripts)
        (set! scripts '())))))

sep =
#(define-music-function (m) (ly:music?)
   #{
     \new Voice <>-$m
   #})

mus = {
  g8 \sep^\upbow g_\upbow g g
  g8 \sep_\upbow g^\upbow g g
}

\version "2.24.0"
\language "english"

\new Staff \mus
\new Staff \with { \consists #equalise-articulations-engraver } \mus

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to