lilypond-user
[Top][All Lists]
Advanced

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

Re: Markup and Score from scheme function


From: Aaron Hill
Subject: Re: Markup and Score from scheme function
Date: Thu, 11 Oct 2018 21:15:51 -0700
User-agent: Roundcube Webmail/1.3.6

On 2018-10-11 1:22 am, Sebastian Käppler wrote:
Hello,

I wonder if it is possible to return markup AND score from a single scheme
function, something like this:

example = #(define-scheme-function (parser location) ()
#{
    \markup "Test"
    \score {
       c'4
    }
#}
)

I created some scripts for teaching and want to include task-markup before each score. Using markup and my functions outside of scheme works, but I
couldn't get  it to work from a single function.

Seems to be that the parser cannot figure out what is meant by #{ \markup ... \score ... #} even though both of those items are permitted to appear at the top-level. With #{ \markup ... #} or #{ \score ... #}, the parser appears to do the right thing.

While there is probably some clever trick that permits #{ \markup ... \score ... #} to parse correctly, I am not seeing it. So, here are two potential options: either nest the score within the markup or vice versa:

%%%%
\version "2.19.82"

\markup "Hello, World!" \score { { a'4 b' g'2 } }

scoreInsideMarkup =
  #(define-scheme-function (label notes) (string? ly:music?)
    #{ \markup { \column { $label \score { $notes } } } #})

markupInsideScore =
  #(define-scheme-function (label notes) (string? ly:music?)
    #{ \score { { \tweak X-offset #(/ -15 1.7573)
       \mark \markup \fontsize #-2 $label $notes } } #})

\scoreInsideMarkup "Hello, World!" { a'4 b' g'2 }
\markupInsideScore "Hello, World!" { a'4 b' g'2 }
%%%%

Note that when using a RehearsalMark, a suitable adjustment to the alignment and font size is needed to match the appearance of the other two.


-- Aaron Hill



reply via email to

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