> Rather regrettably, though, even when I fixed \tweak to -\tweak, or to put > relevant lines within a pair of brackets in my flared-hairpin code, the hairpin > didn’t show up. I now think that it has something to do with another hefty > scheme code that’s referenced via -\tweak commands. I will have to investigate > it once I am finished with my pieces…
But doesn’t this work for you?
%%%
\version "2.24.4"
{
\after 2. \!
c'1
-\tweak Hairpin.color #red
\<
}
%%%
Here it works. The reason here is that actually Lilypond expects after-events
to be prefixed by -/_/^. For regular after-events this does not really matter,
as
the parser is nowadays smart enough to know that e.g. `\<` is an after-even and
will treat it as such. But if you do say this:
%%%
crescendo =
#(define-music-function () () #{ \< #})
{
\after 2. \!
c'1 \crescendo
}
%%%
It won’t work no more: The parser does not know that `\crescendo` returns an
after event, so it assumes that it does not belong to the c.
Now, in most cases this will be fine because what the parser will do in such a
case is to look for any previous note or chord and attach the event to that
one. So
%%%
{ c'1 \crescendo c'\! }
%%%
will work, because the parser does find an unexpected after-event from the
`\crescendo`, but it can handle it, as it has seen the c directly before it.
But this will fail working when the previous note is not directly before it.
Now, if we look at `\after` we see that the syntax is infact `\after duration
music what`, so even though you write it as
%
\after 2. \!
c'1
%
indeed what is happening is
%
\after 2. \! c'1
%
Now it is important to know that post events have higher priority than music
function. So
%
\after 2. \! c'1 -\tweak ... \<
%
is counted as `after(2., \!, c'1-\tweak ... \<)` (in a more typical functional
syntax). But
%
\after 2. \! c'1 \tweak ... \<
%
is counted as `after(2., \!, c'1) \tweak ... \<`.
So the reason this is happening is actually that the whole thing is incorrect
Lilypond code, but the parser can put up with it in most cases. It cannot do
so here.
Cheers,
Tina
signature.asc
Description: This is a digitally signed message part.
