Am 03.12.2015 um 16:57 schrieb Urs Liska:
>
>
> Am 03.12.2015 um 16:24 schrieb Urs Liska:
>>
>>
>> Am 03.12.2015 um 16:19 schrieb Graham King:
>>> On Thu, 2015-12-03 at 15:12 +0100, Urs Liska wrote:
>>>>
>>>>
>>>> Am 03.12.2015 um 15:04 schrieb Graham King:
>>>>
>>>>> I'm trying to enclose some lyrics within square brackets but, for
>>>>> reasons too tedious to trouble the list with*, I'd like to
>>>>> parameterise the brackets using the \foo and \fooEnd constructs in
>>>>> the following pseudocode. Is there a way to do this without
>>>>> causing "[" and "]" to be set as separate syllables?
>>>>>
>>>>> hopefully,
>>>>> -- Graham
>>>>
>>>> HTH:
>>>>
>>>> \version "2.19.21"
>>>>
>>>> theNotes = {
>>>> \relative { e''1 d c }
>>>> }
>>>>
>>>> brack =
>>>> #(define-scheme-function (parser location syllable)(string?)
>>>> (format "[~a]" syllable))
>>>>
>>>> theWords = \lyricmode {
>>>> Three \brack blind mice,
>>>> }
>>>>
>>>> \score
>>>> {
>>>> \new StaffGroup
>>>> <<
>>>> \new Voice = "voice" \theNotes
>>>> \new Lyrics \lyricsto "voice" \theWords
>>>> >>
>>>> }
>>>>
>>>>
>>>> Urs
>>>
>>> Thanks Urs.
>>>
>>> I'm hoping to preserve the \prefixOperator bunch of text
>>> \postfixOperator syntax, so that the operator definition can be
>>> swapped simply for other things that use that syntax, such as:
>>> foo = \override LyricText.color = #red
>>> fooEnd = \revert LyricText.color
>>>
>>> I could adapt your suggestion if I could think of a way to feed the
>>> previous syllable of underlay to \fooEnd
>>
>> So you need a way to also say
>>
>> Three \start deaf and blind \end mice
>>
>> to give you
>> Three [deaf and blind] mice
>> ?
>>
>> Then you simply need three functions:
>> \foo (= start)
>> \bar (= end)
>> \foobar (for a single syllable).
>>
>> I think you can adjust my proposal for start/end-only situations easily.
>
> Ah, forgot: the ending function would also have to be written before
> the syllable, so
>
> Three \foo deaf and \bar blind mice are \foobar alive.
>
> should return
>
> Three [deaf and blind] mice are [alive]
>
> Urs
So, for your original request this should work:
\version "2.19.21"
start =
#(define-scheme-function (parser location syllable)(markup?)
(format "[~a" syllable))
end =
#(define-scheme-function (parser location syllable)(markup?)
(format "~a]" syllable))
wrap =
#(define-scheme-function (parser location syllable)(markup?)
(format "[~a]" syllable))
theNotes = {
\relative { e''1 d c d e }
}
theWords = \lyricmode {
Three \start blind \end mice are \wrap alive
}
\score
{
\new StaffGroup
<<
\new Voice = "voice" \theNotes
\new Lyrics \lyricsto "voice" \theWords
>>
}
But when you also want to do other stuff like coloring it won't because
I don't know how to write a function that returns an override (a music
expression) *and* a string (for the lyrics) at the same time.
Although this must be pretty standard functionality, I think ...
>>
>> Urs
>>>
>>>
>>>
>>> _______________________________________________
>>> lilypond-user mailing list
>>> [email protected]
>>> https://lists.gnu.org/mailman/listinfo/lilypond-user
>>
>>
>>
>> _______________________________________________
>> lilypond-user mailing list
>> [email protected]
>> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
>
>
> _______________________________________________
> lilypond-user mailing list
> [email protected]
> https://lists.gnu.org/mailman/listinfo/lilypond-user
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user