Thanks, Robin and Tina. Great explanations.

Robert

> El 24 abr. 2025, a les 14:00, Valentin Petzel <[email protected]> va 
> escriure:
> 
> Hi Robert,
> 
> > I want to move a \sustainOff horizontally but cannot find the way
> 
> The problem here is that `\sustainOff` is a so called post event, that is, a 
> music event that is written after a note and then attached to this note. Else 
> this would need to be a music function, so instead of
> 
>     c\sustainOff
> 
> you’d need to do
> 
>     \sustainOff c
> 
> Now, `\override ...` changes the default settings in the whole context. So 
> doing
> 
>     \override SustainPedal.X-offset = ...
> 
> will change the X-offset for every SustainPedal grob created from this point 
> on in this Voice context (while \once makes this revert after this timestep). 
> [As Robin pointed out already Pedal marks are created on Staff level, so 
> you’d need `\override Staff.SustainPedal....`
> 
> Now, the issue is that overrides thus need to come before the thing they are 
> supposed to affect are created. But if you do
> 
>     c \override ... \sustainOff
> 
> this is not actually valid syntax. You will actually see a warning about a 
> non-attached sustainEvent. But the parser will still try to make sense of it 
> and thus attach the event to the last note it has found. So this code  is 
> actually interpreted as
> 
>     c\sustainOff \override ...
> 
> But this means (as the \sustainOff is attached to a Note that happens at the 
> same time) that the \override ... needs to come before the note.
> 
> Now, there is a different way to do it which behaves like you tried to do it, 
> which is using tweaks.
> 
> The command `\tweak property value music-event` adds a list of tweaks to the 
> music-event, and a special engraver then changes all properties to the 
> tweaked values. This of course only works when the grob is created by a music 
> event and only if the written property is not used by the original engraver. 
> But for this sorts of tasks tweaks are really the way to go:
> 
>     { c'\sustainOn c'\tweak X-offset 2 \sustainOff }
> 
> Cheers,
> 
> Tina

Reply via email to