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
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user