Edward Neeman <edward.nee...@gmail.com> writes:

> Hello,
>
> I’ve come across some weird behaviour from the \stemNeutral command. This 
> doesn’t work:
>
> %%%%
>
> \version "2.19.82"
>
> \relative {  \stemUp <g' bes d>8) r8
>      \acciaccatura { \stemDown <ges' bes>8 } \stemUp <c e g!> r
>     \stemNeutral c,16 es ges bes }
>
> %%%
>
> Adding a second \stemNeutral command is necessary to reset the stems to 
> normal. Why might this be?

Here is the deal.  \acciaccatura does an implicit \temporary \stemUp (as
that's a default for grace notes) which it cancels at the end of
\acciacatura, provided that it is still active.

\stemDown will cancel this preexisting \temporary \stemUp.
Consequently, \acciacatura does not see the preexisting \temporary
\stemUp at its end any more and will do nothing, in effect leaving a
\temporary \stemDown on the stack.  Your next \stemUp will replace it
with a \temporary \stemUp which will get canceled by \stemNeutral,
making the original \stemUp surface.

Ugh.  The solution is to cancel your \stemDown yourself, using
\stemNeutral .

Now let's assume that \acciaccatura would not do that kind of "matched
pop" at its end and would remove the \stemDown.  Now if you write
\acciaccatura { \stemNeutral ... } this would pop the _preceding_
\stemUp which would be even worse.  And was the reason the current
behavior was implemented.

So maybe the "matched pop" should be done in a different manner: if the
previous state of the stack can be restored, do so, without actually
looking at what you are going to pop in order to get there.

-- 
David Kastrup

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to