lilypond-user
[Top][All Lists]
Advanced

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

Re: conditional markup


From: David Kastrup
Subject: Re: conditional markup
Date: Sat, 14 Jun 2014 16:56:36 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

Orm Finnendahl <address@hidden> writes:

> Hi,
>
>  for defining markups which appear selectively either only in the
> parts or only in the score I'm trying to use the following strategy:
>
> I include a "score-defs.ly" or "part-defs.ly" file in the score or
> part respectively and define commands like "sMarkup" for markup only
> appearing in the score or "pMarkup" for markup only appearing in the
> part by defining them to be effective or have no effect accordingly in
> the part-defs and score-defs.
>
> Unfortunately I can't seem to get the definition straight for the
> custom markup command to mimic the original markup command.
>
> Below is one of my futile attempts. Can anybody help?
>
> \version "2.9.15"

How ancient.

> sMarkup =
> #(define-music-function
>      (parser location markuptext)
>      (markup?)
>    #{
>     \markup { #markuptext }
>    #})
>
> \relative c' { a'^ \sMarkup "Test" }

You probably want a scheme function rather than a music function here.

Well, at least LilyPond wants one:

> Parsing...
> /tmp/markup-def.ly:11:20: error: music function cannot return (#<procedure 
> line-markup (layout props args)> (Test))
> \relative c' { a'^ 
>                    \sMarkup "Test" }
> /tmp/markup-def.ly:11:20: error: post-event expected
> \relative c' { a'^ 
>                    \sMarkup "Test" }

Alternatively, make this an event-function.  In which case you don't
want a markup inside, but, well, an event:

sMarkup =
#(define-event-function
     (parser location markuptext)
     (markup?)
   #{
    -\markup { #markuptext }
   #})

Notice the - before the markup, turning this into a post-event.

-- 
David Kastrup



reply via email to

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