lilypond-user
[Top][All Lists]
Advanced

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

Re: music-to-markup


From: James
Subject: Re: music-to-markup
Date: Wed, 23 Jul 2014 17:16:08 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0

On 23/07/14 17:04, Urs Liska wrote:
Hi all,

is it possible to take a music expression and print out its literal input? In other words: Could I write a function "\example" that takes a music expression as an argument and that first outputs the input code as text and then as a score?

So that

\example {
  \relative c' {
    c8 d e
  }
}

would turn out the same as writing

\markup \typewriter \column {
  "\\relative c' {"
  "  c8 d e"
  "}"
}

\score {
  \relative c' {
    c8 d e f
  }
}

This would be cool for writing LilyPond usage examples where you can print the input and get the result from it. Unfortunately I don't have a clue whether or how this can be achieved.
Isn't this what lilypond-book does already?

When for example you create an

@lilypond[verbatim,relative=1]
...
@end lilypond

It outputs the real output but also with the verbatim gives you the 'code' as well which we use in the docs.

Now that doesn't mean that it translates straight to a SCM function (to make youre \example function) but if you look in the source in $LILYPOND_GIT/python/ all the various book* py files I think would give you clues.

Regards

James




reply via email to

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