Hi,
yes the code was pretty old, about 2007.

So it is good to have updated this topic in the forum.
Thank you to you and everybody!

unofortunately I use Lilypond only once in a while, so I don’t use it enough to 
develop a deep knowledge as I would like.
first one who writes a book/tutorial on Lilypond… kudos!

 best to everybody

massimiliano


> On 1 Nov 2020, at 10:08, Lukas-Fabian Moser <l...@gmx.de> wrote:
> 
> Hi Massimiliano,
> 
> the code you provided is _very_ old. I modified it a bit in order to work 
> with both possible stem directions and respect rests. Also, there was a 
> hard-coded offset for the cross that can more succinctly be replaced by a 
> \center-align.
> 
> I also lenghened the stems a bit. Note that this does not work together with 
> beams - I suspect it's got to do with unpure-pure-containers, which I don't 
> understand :-).
> 
> Best
> Lukas
> \version "2.21.6"
> 
> sp =
> {
>   \override Stem.stencil =
>   #(lambda (grob)
>      (let ((dir (ly:grob-property grob 'direction))
>            (length (ly:grob-property grob 'length))
>            (actual-stem (ly:stem::print grob)))
>        (if (ly:stencil? actual-stem) ; do not add anything if we don't have a 
> stem (e.g. rests)
>            (ly:stencil-combine-at-edge actual-stem
>                                        1
>                                        dir
>                                        (ly:text-interface::print grob)
>                                        (+ (* length -0.5) 0.75)) ; 0.75 is 
> the distance from cross to start of notehead
>            empty-stencil)))
>   \override Voice.Stem.text = \markup \center-align \teeny \musicglyph 
> #"noteheads.s2cross"
>   \override Voice.Stem.length = #(lambda (grob) (+ 0.5 (ly:stem::calc-length 
> grob)))
> }
> 
> \relative {
>   \sp c'4 d e8[ f g a] b4 r c4 d e
>   \undo \sp e d c b a
>   \once \sp g f e
> }
> Am 31.10.20 um 23:03 schrieb Massimiliano Viel:
>> And another possibly outrageous question… when I invoke \sp, it works from 
>> the first following note on to the last note, rests included (!).
>> How do I stop it?
> I showed both \undo\sp and \once\sp in my example.
> 
> Enjoy LilyPond - it's amazing what you can achieve with it!
> 
> Lukas
> 

Reply via email to