Dear LilyPond experts,

I apologise for the length of this message, and humbly ask for your
patience. Most of my use of LilyPond is to produce examples for theory
classes, my forthcoming dissertation, or conference papers. One absolutely
invaluable tool for explicating music is the drawing of all kinds of
arrows. In general I have managed so far using glissandi with arrowheads,
which is fine in many instances, since most arrows begin at a note, but the
need to be attached to a following note makes manipulating where the arrow
goes rather difficult. For example, if I need an arrow to point vertically
downwards from a note I have to hard code the `right X' coordinates to 2
decimal places before it looks vertical, and overstepping the mark produces
an error pointing out that I have moved the right side of the spanner
beyond the left, which places some arrows off limits. I also can't draw
arrows from a note that doesn't have one immediately following it.  I
compromise where I can.  I'm sure I'm doing it inefficiently, and I decided
to try and learn the necessary scheme to create arrows that I can more
easily manipulate, but progress with the extending manual (and the MIT
book) is too slow, so I am coming here for help. I produce maybe 10-20
examples per week, almost all of which include analytical annotations of
one kind or another, so any help you can afford me will definitely save
hours.

Here is an example of the kind of overrides I do to get vertical arrows.
 Note this is just a snippet from a large file - it won't work if you
compile it on its own since the coordinates are specific.  It takes a lot
of time to get the numbers for the X coordinate right, and if I end up
changing anything that alters layout or spacing I have to redo them.


\relative c' {

\override Glissando #'bound-details #'right #'Y = #-7

\override Glissando #'bound-details #'right #'X = #28.5

\override Glissando #'(bound-details right arrow) = ##t

\override Glissando #'arrow-length = #0.6

\override Glissando #'arrow-width = #0.25

 e1 g

g\glissando

\override Glissando #'bound-details #'right #'X = #34.57

g\glissando

\override Glissando #'bound-details #'right #'X = #40.65

g\glissando

g g

}


Some of these things could be included in the .ily files that I use for
examples, but the drawback is that they also affect ordinary glissandi.
Ideally I would like to define a function that can create arrows, but that
doesn't effect settings for other objects (glissandi are excellent for just
drawing lines between two notes). I made some progress with this (see
below) but I am fumbling around in the dark. I managed to recreate a
glissando in a scheme function, but I have no idea how to set properties or
change them. My attempts to stick properties into the following function
all meet with errors (also, why does it not seem to matter whether I
specify a glissando-event or a note-event?):


glissarrow = #(define-music-function (parser location glissando-event)

                                                     (ly:music?)

                      (set! (ly:music-property glissando-event
'articulations)

                             (cons (make-music 'GlissandoEvent)

                                      (ly:music-property glissando-event
'articulations)))

                      glissando-event)


I apologise again for being so verbose, especially about something that is
mostly just a quality-of-life issue, but I am severely time constrained. I
wonder if it might be better to just use an image editor to draw what I
want on the png files.  I really would like to be able to do these things
myself (and eventually to contribute) but the learning curve for scheme is
intimidating (at least for me!).  Thanks in advance for any help, and I
really hope I haven't overlooked an obvious answer in the documentation,
like last time :/


Kevin Barry
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user
  • arrows Kevin Patrick Barry

Reply via email to