lilypond-devel
[Top][All Lists]

## lilypond-book macros/variables

 From: v!ictor address@hidden Subject: lilypond-book macros/variables Date: Tue, 28 Aug 2007 12:01:27 -0400

hello lilyponders,

I've been using lilypond-book for the first time. love it!

There's one thing that I'd like to have though. I'd love to be able to define macros in a similar way as in latex. Is this possible?

From what I've read in the documentation, lilypond-book only knows to look for \begin{lilypond} and \lilypond{ }, so no macros can be defined *for lilypond-book* inside the latex file. If you try to do this, lilypond-book ignores them and then latex tries to interpret them and fails.

So i wrote a little parser that looks for a lilypond delimiter, specifically \lily{ [music] } and replaces that for whatever i define in my parser, for example

\begin[staffsize=12]{lilypond}
\include "bookstyle.ly"
[music]
\end{lilypond}

Now compiling a lilypond-book becomes a three step process:
1. parse book.tex to find \lily{ } and replace with arbitrary lilypond stuff
2. run lilypond-book on book.tex
3. run latex on book.tex

So if there is no way of doing this in lilypond-book, would anyone else be interested in integrating something like this in the core lilypond-book code? would it be useful for others?

best,

victor