lilypond-devel
[Top][All Lists]

## Re: lilypond-book macros/variables

 From: v!ictor address@hidden Subject: Re: lilypond-book macros/variables Date: Thu, 30 Aug 2007 11:15:21 -0400

hello Mats,

victor.

On 8/29/07, Mats Bengtsson < address@hidden> wrote:
In any text editor, it's trivial to automatically replace all occurences of
something like
\lilystart
by
\begin[staffsize=12]{lilypond}
\include "bookstyle.ly <http://bookstyle.ly>"
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)?

/Mats

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

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