lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scheme controllable text spanner padding


From: David Kastrup
Subject: Re: Scheme controllable text spanner padding
Date: Sat, 16 Jul 2016 21:19:58 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

dtsmarin <address@hidden> writes:

> Hello,
>
> How can I create a function such as: \Rpad #2 which will control the padding
> of a text spanner?
>
>  It's only for reducing my code's size since using the \override blah blah
> takes a lot of space if used many times!
> To be absolutely clear this will not used for common things that work well
> but for a custom spanner that needs tweaking every time I use it so having a
> shorter command made sense to me.
>
> Here is a template:
> Rpad = #(define-music-function (parser location %??% ) (number?)
> #{
> ..... %%%%
> #})
> triggered by: 
>
> \Rpad #2 
>
> I hope this can be achieved relatively easy.

With 2.19.35 or so you can use

    Rpad = \override Staff.TextSpanner.padding = \etc

(or whatever you are overriding) and then use \Rpad #2

Of course, you can also write

Rpad = #(define-music-function (parser location arg) (number?)
#{
   \override Staff.TextSpanner.padding = #arg
#})

and this has the slight advantage that \Rpad will check right away for
"arg" being a number and possibly coerce it to one (well, if you are
overriding with a callback or with #f this might actually be a
nuisance).  The version with \etc is just passing the argument as-is.

-- 
David Kastrup



reply via email to

[Prev in Thread] Current Thread [Next in Thread]