[Top][All Lists]

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

Re: lilypond-book macros/variables

From: Mats Bengtsson
Subject: Re: lilypond-book macros/variables
Date: Wed, 29 Aug 2007 12:54:49 +0200
User-agent: Thunderbird (X11/20070716)

In any text editor, it's trivial to automatically replace all occurences of
something like
\include " <>"
or whatever, so I have personally not seen any need for this feature.
Of course it's very clever to do what you did, namely to include a
separate .ly file that contains all the necessary settings.

If you have a large number of short snippets, I see that your solution might be
convenient. Did you consider using a standard preprocessor like CPP or M4
(search the mailing list archives for "preprocessor" for some related discussions
on the use of preprocessors in pure .ly files)?


v!ictor address@hidden wrote:

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

\include " <>"

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?




lilypond-user mailing list

        Mats Bengtsson
        Signal Processing
        Signals, Sensors and Systems
        Royal Institute of Technology
        SE-100 44  STOCKHOLM
        Phone: (+46) 8 790 8463                         
       Fax:   (+46) 8 790 7260
        Email: address@hidden

reply via email to

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