[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Guitar notation - scheme function for slurs with markup
From: |
Lukas-Fabian Moser |
Subject: |
Re: Guitar notation - scheme function for slurs with markup |
Date: |
Sun, 29 May 2022 20:29:18 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 |
Hi Stefan,
please try to always give a compilable examle, otherwise people have to
collect your ideas from your mail bit by bit :).
You could use an event-function; these are made for postfix use (i.e.
after the respective note):
\version "2.22"
ho = #(define-event-function
(spacing)
(number?)
#{
-^(^\markup {\halign #spacing ho}
#})
\new Staff {
e''8 f''8\ho #-1.5 a'')
}
Note that I had to escape the -1.5 with #, this is expected for negative
numbers.
With this solution, the "spacing" parameter cannot be made optional.
This can be achieved by going back to music functions and putting the
(optional) spacing first:
\version "2.22"
ho = #(define-music-function
(spacing music)
((number? -1.5) ly:music?)
#{
<>-^(^\markup {\halign #spacing ho}
#music
#})
\new Staff {
e''8 \ho #-2.5 f''8 a'')
}
\new Staff {
e''8 \ho f''8 a'')
}
Here, I have used the "empty chord trick": <> is an empty chord that
doesn't take up time; any slurs and articulations attached to this chord
will be attached to the first bit of music coming after it.
I hope I didn't miss important parts of your question in my hurry :-).
Lukas