lilypond-user
[Top][All Lists]
Advanced

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

Re: barré variables and TextSpanner


From: Thomas Morley
Subject: Re: barré variables and TextSpanner
Date: Sun, 18 Nov 2012 14:28:22 +0100

2012/11/18 Federico Bruni <address@hidden>:
> I'm currently using these simple variables to reduce the clutter in my
> files:
>
> barreI = \override TextSpanner #'(bound-details left text) = #"B I "
> barreII = \override TextSpanner #'(bound-details left text) = #"B II "
> barreIII = \override TextSpanner #'(bound-details left text) = #"B III "
> ...
>
> I'm ok with adding \startTextSpan and \stopTextSpan every time. I just
> wanted to save some space in the music input.
>
> Now I'd like to avoid this long list of frets and define a function which
> can take the fret as argument. So I can use:
>
> \barre #"I"
> \barre #"V"
>
> I think that it would be easier to maintain, but I don't know where to
> start.
> I've found this snippet in the LSR:
> http://lsr.dsi.unimi.it/LSR/Item?id=632
>
> But it's aimed at chords. Also, it works only in 2.14.2, not in 2.16
>
> Thanks
> --
> Federico
>
> _______________________________________________
> lilypond-user mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/lilypond-user

Hi Federico,

boiled down, you want to use a function to set 'left 'text of TextSpanner.

How about:

\version "2.16.0"

barre =
#(define-music-function (parser location strg)(string?)
(let ((arg (string-append "B " strg)))
#{
        \override TextSpanner #'(bound-details left text) = $arg
#}))

startBarre = \startTextSpan
stopBarre = \stopTextSpan

\relative c' {
        \barre I c4\startTextSpan  d e f\stopTextSpan
        \barre II g\startBarre a b c\stopBarre
}


HTH,
  Harm



reply via email to

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