bug-lilypond
[Top][All Lists]
Advanced

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

Re: Document/Example how to create "standalone" markup commands


From: David Kastrup
Subject: Re: Document/Example how to create "standalone" markup commands
Date: Thu, 07 Jun 2018 14:40:49 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Urs Liska <address@hidden> writes:

> Hi all,
>
> I have regularly struggled to get this to work, and now I think there
> should be an additional example in Extending, 2.4 and/or 2.5.
>
> The description in 2.5 explains how to define a markup function that
> can be used as
>
> {
>   c' \markup \double-box "Some text"
> }
>
> This makes sense, as "double-box" is a natural name for a style
> applied to a markup. However, pretty often one may want to have
> "standalone" markup commands that can be used like e.g.
>
> {
>   c'1 \player "Perc. 1" d' player "Perc. 2
> }
>
> While it's perfectly possible to use "\markup \player" here too it's
> often relevant to semantically encode elements just like you encode
> \mark or \fermata.

Which are not markup at all.  They can only be used in music.

> It took me some time to figure out that \double-box can be written and
> used like
>
> doubleBox =
> #(define-event-function (text) (markup?)
>    (make-music 'TextScriptEvent 'text
>      (markup #:override '(box-padding . 0.4) #:box
>        #:override '(box-padding . 0.6) #:box text)))
>
> \relative {
>   c'1 \doubleBox "Implicitly Neutral"
>   c -\doubleBox "Explicitly neutral"
>   c ^\doubleBox Above
>   c _\doubleBox Below
> }

doubleBox = -\markup \override #'(box-padding . 0.4) \box
                     \override #'(box-padding . 0.6) \box \etc

There you go.

-- 
David Kastrup



reply via email to

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