lilypond-user
[Top][All Lists]
Advanced

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

Defining a function that passes contents between braces to a markup


From: Mojca Miklavec
Subject: Defining a function that passes contents between braces to a markup
Date: Sat, 16 Jul 2016 02:23:46 +0200

Hi,

I've learnt some basics of scheme and managed to write some simple
functions, but I'm unable to figure out how to write a function that
would take all the contents between braces as an argument and return a
markup.

I would be grateful even if I get just the simplified version working, so that

    \A {<foo>}

would be translated into

    \markup { \small \override #'(direction . 1) { \dir-column { <foo> } } }

I would use this markup as part of the lyrics as in

    \lyricsto "melody" {
        \A {foo bar}
        \A {three short lines}
        \A {one}
    }

In a slightly more advanced version it would be nice to be able to type

    \lyricsto "melody" {
      % \command { array of values }
      %            each entry can have an optional "-<number>"
      \A {A1-1}
      \A {A1-1 C2-2}
      \A {A1-1 C2-2 E2-3}
      \A {C2 E2-3}
      \A {E2}
    }

or something similar and be able to separate the optional number after
the dash and format it differently. But I can live without that extra
feature.


So far I came up with a function definition

M = #(define-scheme-function (parser location aFinger aButton) (markup? markup?)
  #{ \markup{ \small \bold \with-color #(rgb-color 0.5 0 0) #aFinger
\small \with-color #(rgb-color 0 0 0.5) #aButton } #}
)
that can handle input like
    \M "1" "A1"
and then I would enter multiple lines of lyrics, but this is tedious
to write, even more so when the number of lines varies from one pitch
to the other.


The example of what I want to achieve is in the attachment.

Any hints greatly appreciated.

Thank you,
    Mojca

Attachment: function-to-type-multiline-markup-above-scores.ly
Description: Binary data


reply via email to

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