Parenthesis/bracket/brace questions

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Parenthesis/bracket/brace questions

Brent Annable

Hi all,

So I'm working on a score at the moment and have run into two challenges:

1. Does anybody have an idea how to insert large, cross-staff square braces (effectively parenthesizing the entire staff) as in the link below? I have no idea how to even start.


2. I would like to parenthesize a couple of two-note chords in the tenor part. Has anybody come up with a decent way to put parentheses around entire chords yet? I've rummaged around the old threads but can't really find anything that fits the bill. 

The below example shows the two chords I need; the solution to the second one kind of works because the chord has a middle note that can be parenthesized and made invisible (and I assume the dot as well, although I haven't figured that out yet), then the parenthesis enlarged to span the entire chord. But the chord before it doesn't, and I can't figure out a way to either move or centre the parentheses:


\version "2.19.65"

\relative c' { \override ParenthesesItem.font-size = #3
\key es \major
<f  as> < bes \hide \parenthesize g es>2.
}


I would be grateful for any help.

Thanks and regards,

Brent.




_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

RE: Parenthesis/bracket/brace questions

Mark Stephen Mrotek

Brent,

 

As to No. 1, perhaps a cross staff arpeggio/bracket?

 

http://lilypond.org/doc/v2.19/Documentation/notation/expressive-marks-as-lines#arpeggio

 

Mark

 

From: lilypond-user [mailto:lilypond-user-bounces+carsonmark=[hidden email]] On Behalf Of Brent Annable
Sent: Sunday, May 20, 2018 7:31 AM
To: lilypond-user <[hidden email]>
Subject: Parenthesis/bracket/brace questions

 

 

Hi all,

 

So I'm working on a score at the moment and have run into two challenges:

 

1. Does anybody have an idea how to insert large, cross-staff square braces (effectively parenthesizing the entire staff) as in the link below? I have no idea how to even start.

 

 

2. I would like to parenthesize a couple of two-note chords in the tenor part. Has anybody come up with a decent way to put parentheses around entire chords yet? I've rummaged around the old threads but can't really find anything that fits the bill. 

 

The below example shows the two chords I need; the solution to the second one kind of works because the chord has a middle note that can be parenthesized and made invisible (and I assume the dot as well, although I haven't figured that out yet), then the parenthesis enlarged to span the entire chord. But the chord before it doesn't, and I can't figure out a way to either move or centre the parentheses:

 

 

\version "2.19.65"

 

\relative c' { \override ParenthesesItem.font-size = #3

\key es \major

<f  as> < bes \hide \parenthesize g es>2.

}

 

 

I would be grateful for any help.

 

Thanks and regards,

 

Brent.

 

 

 


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Parenthesis/bracket/brace questions

Robin Bannister-2
In reply to this post by Brent Annable
Brent Annable wrote:

> 2. I would like to parenthesize a couple of two-note chords in the tenor
> part. Has anybody come up with a decent way to put parentheses around
> entire chords yet? I've rummaged around the old threads but can't really
> find anything that fits the bill.


Maybe you can make do with the \parch function given (at the end of)
https://archiv.lilypondforum.de/index.php/topic,347.msg10786/topicseen.html#msg10786

Then you would just write
 >
 > \parch #2.5 <f as>4 \parch #3.7 <bes es,>2.
 >

But this hack doesn't prevent the right bracket colliding with things.


Cheers,
Robin

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Parenthesis/bracket/brace questions

Brent Annable
In reply to this post by Mark Stephen Mrotek
Hey Mark,

Thank you for your response. Yes I considered the arpeggio bracket option, but the problem is I'm using that extensively throughout the edition to indicate right-hand chords, so I wanted something that looks a little different to avoid confusion. A staff brace would seem ideal, but I'm not a programmer so I have no idea how to manipulate one into the middle of the staff.

I suppose I could just use another solution (such as small notes), but this looks rather elegant so I'd like to stick at it if possible.

Brent.

On 21 May 2018 at 01:16, Mark Stephen Mrotek <[hidden email]> wrote:

Brent,

 

As to No. 1, perhaps a cross staff arpeggio/bracket?

 

http://lilypond.org/doc/v2.19/Documentation/notation/expressive-marks-as-lines#arpeggio

 

Mark

 

From: lilypond-user [mailto:[hidden email]=[hidden email]] On Behalf Of Brent Annable
Sent: Sunday, May 20, 2018 7:31 AM
To: lilypond-user <[hidden email]>
Subject: Parenthesis/bracket/brace questions

 

 

Hi all,

 

So I'm working on a score at the moment and have run into two challenges:

 

1. Does anybody have an idea how to insert large, cross-staff square braces (effectively parenthesizing the entire staff) as in the link below? I have no idea how to even start.

 

 

2. I would like to parenthesize a couple of two-note chords in the tenor part. Has anybody come up with a decent way to put parentheses around entire chords yet? I've rummaged around the old threads but can't really find anything that fits the bill. 

 

The below example shows the two chords I need; the solution to the second one kind of works because the chord has a middle note that can be parenthesized and made invisible (and I assume the dot as well, although I haven't figured that out yet), then the parenthesis enlarged to span the entire chord. But the chord before it doesn't, and I can't figure out a way to either move or centre the parentheses:

 

 

\version "2.19.65"

 

\relative c' { \override ParenthesesItem.font-size = #3

\key es \major

<f  as> < bes \hide \parenthesize g es>2.

}

 

 

I would be grateful for any help.

 

Thanks and regards,

 

Brent.

 

 

 



_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Parenthesis/bracket/brace questions

Brent Annable
In reply to this post by Robin Bannister-2
Hey Robin!

Thank you, this works just fine in this case. What would be really neat now would be the ability to parenthesize entire chordal passages, so with the left half around one chord and the right half around some other chord later on in the music. So like a combination of this function:

startParenthesis = {
  \once \override ParenthesesItem.stencils = #(lambda (grob)
        (let ((par-list (parentheses-item::calc-parenthesis-stencils grob)))
          (list (car par-list) point-stencil )))
}

endParenthesis = {
  \once \override ParenthesesItem.stencils = #(lambda (grob)
        (let ((par-list (parentheses-item::calc-parenthesis-stencils grob)))
          (list point-stencil (cadr par-list))))
}


And this function:


parch =  #(define-music-function (parser location gap) (number?) 
#{
   \once \override Arpeggio #'stencil = #(lambda (grob)
     (ly:stencil-add
       (ly:arpeggio::brew-chord-slur grob)
       (ly:stencil-translate-axis 
         (ly:stencil-rotate (ly:arpeggio::brew-chord-slur grob) 180 0 0)
         gap X)))
   \once \override Arpeggio #'X-extent = #(lambda (grob)
     (ly:stencil-extent (ly:arpeggio::brew-chord-slur grob) X))
   \once \override Arpeggio #'positions = #(lambda (grob) 
     (interval-widen (ly:arpeggio::calc-positions grob) 0.5))
   $(make-music 'EventChord 'elements (list (make-music 'ArpeggioEvent)))
#})


Here's a sample of the startParenthesis/endParenthesis in use:

\version "2.19.65"
startParenthesis = {
  \once \override ParenthesesItem.stencils = #(lambda (grob)
        (let ((par-list (parentheses-item::calc-parenthesis-stencils grob)))
          (list (car par-list) point-stencil )))
}
endParenthesis = {
  \once \override ParenthesesItem.stencils = #(lambda (grob)
        (let ((par-list (parentheses-item::calc-parenthesis-stencils grob)))
          (list point-stencil (cadr par-list))))
}

\relative c' { \override ParenthesesItem.font-size = #2
                   c d \startParenthesis \parenthesize e f 
                   g a \endParenthesis \parenthesize b c
                  }


Any takers?

Regards,

Brent.

On 21 May 2018 at 06:14, Robin Bannister <[hidden email]> wrote:
Brent Annable wrote:

2. I would like to parenthesize a couple of two-note chords in the tenor
part. Has anybody come up with a decent way to put parentheses around
entire chords yet? I've rummaged around the old threads but can't really
find anything that fits the bill.


Maybe you can make do with the \parch function given (at the end of)
https://archiv.lilypondforum.de/index.php/topic,347.msg10786/topicseen.html#msg10786

Then you would just write
>
> \parch #2.5 <f as>4 \parch #3.7 <bes es,>2.
>

But this hack doesn't prevent the right bracket colliding with things.


Cheers,
Robin


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user

parentheses.pdf (45K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Parenthesis/bracket/brace questions

Andrew Bernard
In reply to this post by Brent Annable
Hi Brent,

Unless I am totally missing the point, this was discussed on the list a couple of years ago, and a simple solution provided oin LSR 957. Is the following not what you want?

Andrew

====


% LSR 957

#(define-markup-command (openBracket layout props heitgh) (number?)
   (interpret-markup layout props
     (markup #:line (#:with-dimensions (cons 0 0) (cons 0 0)
                      (#:path 0.25
                        (list (list (quote moveto) 0 0)
                          (list (quote lineto) -1 0)
                          (list (quote lineto) -1 (* heitgh -1))
                          (list (quote lineto) 0 (* heitgh -1))))))))

#(define-markup-command (closeBracket layout props heitgh) (number?)
   (interpret-markup layout props
     (markup #:line (#:with-dimensions (cons 0 0) (cons 0 0)
                      (#:path 0.25
                        (list (list (quote moveto) 1.3 0)
                          (list (quote lineto) 2.3 0)
                          (list (quote lineto) 2.3 (* heitgh -1))
                          (list (quote lineto) 1.3 (* heitgh -1))))))))


%%%

upper = {
  c''4 4^\markup\openBracket #14  4^\markup\closeBracket #14  4
}

lower = {
  \clef bass
  c4 4 4 4
}

\score {
  <<
    \new Staff {
      \upper
    }
    \new Staff {
      \lower
    }
  >>
  \layout {
  }
}

====



On 21 May 2018 at 00:31, Brent Annable <[hidden email]> wrote:

1. Does anybody have an idea how to insert large, cross-staff square braces (effectively parenthesizing the entire staff) as in the link below? I have no idea how to even start.



_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Parenthesis/bracket/brace questions

Brent Annable
Hey Andrew,

Wow, this looks like exactly like my score! Thank you very much, I managed to tweak the values of this code to get exactly the shape I needed.

On a side note, in my searches I noticed it's now possible to define different barline types, and the bracket type looks like it would also do the job very well here... but I can't get the brace to span both staves without having 'horns' (there seems to be some weird spanning behaviour too):

\version "2.19.65"

\defineBarLine "[" #'("" "[" ".")
\defineBarLine "]" #'("]" "" ".")

upper = {
  c''4 \bar "[" 4 4 \bar "]" 4
}

lower = {
  \clef bass
  c4 4 4 4
}

\score {
  \new PianoStaff <<
    \new Staff {
      \upper
    }
    \new Staff {
      \lower
    }
  >>
}

Any ideas? I'm stumped.

Brent.

On 21 May 2018 at 17:10, Andrew Bernard <[hidden email]> wrote:
Hi Brent,

Unless I am totally missing the point, this was discussed on the list a couple of years ago, and a simple solution provided oin LSR 957. Is the following not what you want?

Andrew

====


% LSR 957

#(define-markup-command (openBracket layout props heitgh) (number?)
   (interpret-markup layout props
     (markup #:line (#:with-dimensions (cons 0 0) (cons 0 0)
                      (#:path 0.25
                        (list (list (quote moveto) 0 0)
                          (list (quote lineto) -1 0)
                          (list (quote lineto) -1 (* heitgh -1))
                          (list (quote lineto) 0 (* heitgh -1))))))))

#(define-markup-command (closeBracket layout props heitgh) (number?)
   (interpret-markup layout props
     (markup #:line (#:with-dimensions (cons 0 0) (cons 0 0)
                      (#:path 0.25
                        (list (list (quote moveto) 1.3 0)
                          (list (quote lineto) 2.3 0)
                          (list (quote lineto) 2.3 (* heitgh -1))
                          (list (quote lineto) 1.3 (* heitgh -1))))))))


%%%

upper = {
  c''4 4^\markup\openBracket #14  4^\markup\closeBracket #14  4
}

lower = {
  \clef bass
  c4 4 4 4
}

\score {
  <<
    \new Staff {
      \upper
    }
    \new Staff {
      \lower
    }
  >>
  \layout {
  }
}

====



On 21 May 2018 at 00:31, Brent Annable <[hidden email]> wrote:

1. Does anybody have an idea how to insert large, cross-staff square braces (effectively parenthesizing the entire staff) as in the link below? I have no idea how to even start.




_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user

brace-barline.pdf (39K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Parenthesis/bracket/brace questions

Thomas Morley-2
2018-05-21 15:03 GMT+02:00 Brent Annable <[hidden email]>:

> Hey Andrew,
>
> Wow, this looks like exactly like my score! Thank you very much, I managed
> to tweak the values of this code to get exactly the shape I needed.
>
> On a side note, in my searches I noticed it's now possible to define
> different barline types, and the bracket type looks like it would also do
> the job very well here... but I can't get the brace to span both staves
> without having 'horns' (there seems to be some weird spanning behaviour
> too):
>
> \version "2.19.65"
>
> \defineBarLine "[" #'("" "[" ".")
> \defineBarLine "]" #'("]" "" ".")
>
> upper = {
>   c''4 \bar "[" 4 4 \bar "]" 4
> }
>
> lower = {
>   \clef bass
>   c4 4 4 4
> }
>
> \score {
>   \new PianoStaff <<
>     \new Staff {
>       \upper
>     }
>     \new Staff {
>       \lower
>     }
>   >>
> }
>
> Any ideas? I'm stumped.
>
> Brent.

Hi Brent,

(1)
thanks for spotting a bug in the definition of `make-bracket-bar-line'.
It will need further testings, before I can think of putting up a
patch, but I propose the fix below:

#(define ((make-bracket-bar-line dir) grob extent)
  "Draw a bracket-style bar line. If @var{dir} is set to @code{LEFT}, the
opening bracket will be drawn, for @code{RIGHT} we get the closing bracket."
  (let* ((thick-stil (make-thick-bar-line grob extent))
         (brackettips-up (ly:font-get-glyph (ly:grob-default-font grob)
                                            "brackettips.up"))
         (brackettips-down (ly:font-get-glyph (ly:grob-default-font grob)
                                              "brackettips.down"))
         ;; the x-extent of the brackettips must not be taken into account
         ;; for bar line constructs like "[|:", so we set new bounds:
         (tip-up-stil (ly:make-stencil (ly:stencil-expr brackettips-up)
                                       (cons 0 0)
                                       (ly:stencil-extent brackettips-up Y)))
         (tip-down-stil (ly:make-stencil (ly:stencil-expr brackettips-down)
                                         (cons 0 0)
                                         (ly:stencil-extent
brackettips-down Y)))
         (stencil (ly:stencil-add
                   thick-stil
                   (ly:stencil-translate-axis tip-up-stil
                                              (interval-end extent)
                                              Y)
                   (ly:stencil-translate-axis tip-down-stil
                                              (interval-start extent)
                                              Y))))

    (if (eqv? dir LEFT)
        stencil
        ;(ly:stencil-scale stencil -1 1)
        (flip-stencil X stencil)
        )))

#(add-bar-glyph-print-procedure "[" (make-bracket-bar-line LEFT))
#(add-bar-glyph-print-procedure "]" (make-bracket-bar-line RIGHT))


%% Example

#(define-bar-line "[" "|" "[" ".")
#(define-bar-line "]" "]" #f ".")


#(define-bar-line "[|:" "|" "[|:" ".|")
#(define-bar-line ":|]" ":|]" #f " |.")
#(define-bar-line ":|][|:" ":|]" "[|:" " |..|")

upper = {
  c''4 \bar "[" 4 4 \bar "]" 4
  c''4 \bar "[|:" 4 \bar ":|][|:" 4 \bar ":|]" 4
}

lower = {
  \clef bass
  c4 4 4 4
  c4 4 4 4
}

\score {
  \new PianoStaff <<
    \new Staff {
      \upper
    }
    \new Staff {
      \lower
    }
  >>
}

(2) You will always get those brackettips for every staff. It's a
limitation, caused by the way LilyPond prints BarLines/SpanBars.

As workaround two LSR-snippets are available:
http://lsr.di.unimi.it/LSR/Item?id=1032
http://lsr.di.unimi.it/LSR/Item?id=991



Cheers,
  Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Parenthesis/bracket/brace questions

Thomas Morley-2
2018-05-21 17:09 GMT+02:00 Thomas Morley <[hidden email]>:

> 2018-05-21 15:03 GMT+02:00 Brent Annable <[hidden email]>:
>> Hey Andrew,
>>
>> Wow, this looks like exactly like my score! Thank you very much, I managed
>> to tweak the values of this code to get exactly the shape I needed.
>>
>> On a side note, in my searches I noticed it's now possible to define
>> different barline types, and the bracket type looks like it would also do
>> the job very well here... but I can't get the brace to span both staves
>> without having 'horns' (there seems to be some weird spanning behaviour
>> too):
>>
>> \version "2.19.65"
>>
>> \defineBarLine "[" #'("" "[" ".")
>> \defineBarLine "]" #'("]" "" ".")
>>
>> upper = {
>>   c''4 \bar "[" 4 4 \bar "]" 4
>> }
>>
>> lower = {
>>   \clef bass
>>   c4 4 4 4
>> }
>>
>> \score {
>>   \new PianoStaff <<
>>     \new Staff {
>>       \upper
>>     }
>>     \new Staff {
>>       \lower
>>     }
>>   >>
>> }
>>
>> Any ideas? I'm stumped.
>>
>> Brent.
>
> Hi Brent,
>
> (1)
> thanks for spotting a bug in the definition of `make-bracket-bar-line'.
> It will need further testings, before I can think of putting up a
> patch, but I propose the fix below:
>
> #(define ((make-bracket-bar-line dir) grob extent)
>   "Draw a bracket-style bar line. If @var{dir} is set to @code{LEFT}, the
> opening bracket will be drawn, for @code{RIGHT} we get the closing bracket."
>   (let* ((thick-stil (make-thick-bar-line grob extent))

;; To test in a local file replace above with:
;;   (not needed if the fix is done in bar-line.scm):
(thick-stil ((@@ (lily) make-thick-bar-line) grob extent))

>          (brackettips-up (ly:font-get-glyph (ly:grob-default-font grob)
>                                             "brackettips.up"))
>          (brackettips-down (ly:font-get-glyph (ly:grob-default-font grob)
>                                               "brackettips.down"))
>          ;; the x-extent of the brackettips must not be taken into account
>          ;; for bar line constructs like "[|:", so we set new bounds:
>          (tip-up-stil (ly:make-stencil (ly:stencil-expr brackettips-up)
>                                        (cons 0 0)
>                                        (ly:stencil-extent brackettips-up Y)))
>          (tip-down-stil (ly:make-stencil (ly:stencil-expr brackettips-down)
>                                          (cons 0 0)
>                                          (ly:stencil-extent
> brackettips-down Y)))
>          (stencil (ly:stencil-add
>                    thick-stil
>                    (ly:stencil-translate-axis tip-up-stil
>                                               (interval-end extent)
>                                               Y)
>                    (ly:stencil-translate-axis tip-down-stil
>                                               (interval-start extent)
>                                               Y))))
>
>     (if (eqv? dir LEFT)
>         stencil
>         ;(ly:stencil-scale stencil -1 1)
>         (flip-stencil X stencil)
>         )))
>
> #(add-bar-glyph-print-procedure "[" (make-bracket-bar-line LEFT))
> #(add-bar-glyph-print-procedure "]" (make-bracket-bar-line RIGHT))
>
>
> %% Example
>
> #(define-bar-line "[" "|" "[" ".")
> #(define-bar-line "]" "]" #f ".")
>
>
> #(define-bar-line "[|:" "|" "[|:" ".|")
> #(define-bar-line ":|]" ":|]" #f " |.")
> #(define-bar-line ":|][|:" ":|]" "[|:" " |..|")
>
> upper = {
>   c''4 \bar "[" 4 4 \bar "]" 4
>   c''4 \bar "[|:" 4 \bar ":|][|:" 4 \bar ":|]" 4
> }
>
> lower = {
>   \clef bass
>   c4 4 4 4
>   c4 4 4 4
> }
>
> \score {
>   \new PianoStaff <<
>     \new Staff {
>       \upper
>     }
>     \new Staff {
>       \lower
>     }
>   >>
> }
>
> (2) You will always get those brackettips for every staff. It's a
> limitation, caused by the way LilyPond prints BarLines/SpanBars.
>
> As workaround two LSR-snippets are available:
> http://lsr.di.unimi.it/LSR/Item?id=1032
> http://lsr.di.unimi.it/LSR/Item?id=991
>
>
>
> Cheers,
>   Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Parenthesis/bracket/brace questions

Thomas Morley-2
In reply to this post by Thomas Morley-2
2018-05-21 17:09 GMT+02:00 Thomas Morley <[hidden email]>:
> 2018-05-21 15:03 GMT+02:00 Brent Annable <[hidden email]>:

>> On a side note, in my searches I noticed it's now possible to define
>> different barline types, and the bracket type looks like it would also do
>> the job very well here... [...]
>> (there seems to be some weird spanning behaviour
>> too):
>>
>> \version "2.19.65"
>>
>> \defineBarLine "[" #'("" "[" ".")
>> \defineBarLine "]" #'("]" "" ".")
>>
>> upper = {
>>   c''4 \bar "[" 4 4 \bar "]" 4
>> }
>>
>> lower = {
>>   \clef bass
>>   c4 4 4 4
>> }
>>
>> \score {
>>   \new PianoStaff <<
>>     \new Staff {
>>       \upper
>>     }
>>     \new Staff {
>>       \lower
>>     }
>>   >>
>> }
>>
>> Any ideas? I'm stumped.
>>
>> Brent.
>
> Hi Brent,
>
> (1)
> thanks for spotting a bug in the definition of `make-bracket-bar-line'.
> It will need further testings, before I can think of putting up a
> patch, but I propose the fix below:
>

patch is up:
https://sourceforge.net/p/testlilyissues/issues/5329/

Cheers,
  Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user