[Top][All Lists]

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

Re: extending \lilypondfile was: Re: Extracting header fields for use by

From: Bernard Hurley
Subject: Re: extending \lilypondfile was: Re: Extracting header fields for use by e.g. LaTeX?
Date: Tue, 13 Dec 2005 08:55:04 +0000


I was going to post this stuff on Sunday, however I live in Hemel
Hempstead and have been a bit pre-occupied with other things. Here is a
first attempt at solving the problem.  I might not have much time to
work on this in the near future, but would appreciate any suggestions.

I attach a file called "lilypond-macros" (not a very good name -maybe
someone can think of another one). You will have to do a bit of editing
to get it working on your system (I think I have documented it enough in
the file - if you search for "invisible" you should find the lines that
need changing).

If you compare the effect of running:

        lilypond-book -V --psfonts <name>.lytex


        lilypond-macros -V --psfonts <name>.lytex

You will see that l-b substitutes inline code for the embedded LaTeX
code whereas l-m substitutes a call to "\lilyInputSystems". This macro
is contained in a file "<name>.mac" that is "\input" at the top of the
resulting .tex file.

>From now on "<name>.mac" can be used in _any_ TeX file. You must write:

        \usepackage{graphics}  %% or: \usepackage{graphicx}
        \include <name>.mac

in your preamble. The macros available are:

1] \lilyInputSystems{<song name>}

        This macro causes the music to be displayed so that it looks identical
the corresponding inline code generated by l-b. It takes account of
parameters "quote" and "verbatim" if they have been used in the
original .lytex file. The macros below do _not_ do this.

2] \lilyInputSingle{<song name>}{<system number>}

         A single system is displayed.

3] \lilyInputRange{<song name>}{<first system>}{<last system>}

        a Range of systems is displayed

4] \lilyInputVerbatim{<song name>}

        the verbatim lilypond code is displayed

5] \lilyHeader{<song name>}{<header name>}

        The lilypond header named "<header name>" is displayed.
At present l-m only finds the _first_ header block in the code. Also the
macro is fragile so you should write:




Some points:

A] The song names are at present generated by l-m etc. and have the form
"SongA", "SongB" etc... And you will have to look in the generated .tex
code to see what they are.

B] The systems are numbered starting from "1". You will obviously have
to turn the generated .tex into .ps or .pdf to find out how many there

C] If you are happy with the generated macros you don't actually have to
run l-m again. You can simply work with .tex

D] At present you cannot "\import" two .mac files into the same LaTeX
file. Eventually it should be possible to gnerate libraries of songs for
use in LaTeX.

e] You don't need all the generated files to use the macros. The ones
you need in addition to the .mac file are:


And if you are using the --psfonts option, <name>.psfonts will be needed
by dvips.


On Sat, 2005-12-10 at 21:37 -0500, Michael Haynie wrote: 
> OK, I'm back from Alaska.  Sorry for the delay.
> LaTeX macros with multiple parameters typically separate them with {}, 
> so it would look like this:
> \lilypondfile[options]{filename}{reference}
> I thought we'd have lilypond-book provide the reference number, so I'm 
> not sure what the reference would be, but I suppose that it could be 
> provided by lilypond-book during the rewrite step.  The rewrite is 
> currently replacing the call with stuff surrounding an \input.  I think 
> I'd replace the \input with a call to yet another macro to be user 
> defined, maybe following the \ifx pattern used by pre and post 
> LilyPondExample.  Something like:
> \includeLilypondSystems{reference number}{system count}
> The user would define includeLilypondSystems to e.g. discard the title, 
> print the first system, or whatever.  The main weakness that I see is 
> that users would have to redefine the macro if they need to use several 
> definitions in the same book.  I'm not sure I know why one would want 
> to do that, but my need to do my own titles suggests that others might 
> need to do similarly odd things.
> On Dec 2, 2005, at 8:53 AM, Bernard Hurley wrote:
> > On Thu, 2005-12-01 at 14:02 +0000, Bernard Hurley wrote:
> >> Hi,
> >>
> >> This discussion, started on the "user" list. However it now seems more
> >> appropriate for the "developer". We started discussing how header 
> >> fields
> >> might be used in lilypond-book and got on to discussing a possible
> >> extension to \lilypondfile, with an optional extra parameter (As in
> >> \lilypondfile[mysong{}). It should be possible for anyone
> >> interested to pick it up from here.
> >>
> > Sorry it wouldn't quite work like this. Perhaps something like
> >     \lilypondfile[options]{filename,reference}
> > would be better
> > -- 
> > Bernard Hurley <address@hidden>
> >
Bernard Hurley <address@hidden>

reply via email to

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