Extracting header fields for use by e.g. LaTeX?

classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

Extracting header fields for use by e.g. LaTeX?

Michael Haynie

Greetings;

I'm looking for a way to produce Table of Contents entries, Index
entries, and song numbers for songs in a song book.  In Lilypond 2.2, I
replaced the the LaTeX titling definitions to suit my needs, but that
doesn't seem to be an option with 2.6.  Short of hacking scheme in some
nonstandard way, it's not obvious to me how to proceed.  I'd like to
avoid non-standard approaches, since they're likely to break with the
next version of Lilypond.

Ideally, I'd like to have lilypond not set the titles directly -- just
write a LaTeX snippet defining the relevant portions.  That way I can
rely on LaTeX's excellent features.  TOC entries and index entries are
relatively simple to manage.  The most difficult issue will be keeping
track of song numbers and setting the song number on the right or left
depending on whether the song is on a right hand page or left hand
page.  That's easy to handle if the decision is made by LaTeX.  I think
it would be impractical to have lilypond attempt that task.

Is that possible to accomplish with the current header handling
mechanisms and lilypond-book?  What would the rough outline look like?

Thanks.



_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Extracting header fields for use by e.g. LaTeX?

Bernard Hurley-3
On Sat, 2005-11-26 at 20:26 -0500, Michael Haynie wrote:

If you are using lilypond-book it is probably easier to forget about
header fields and do something like:

\section{Prelude}
--- some other text ----
\lilypondfile[indent=1.2\cm]{prelude.ly}

in your lytex file. You can then easily generate a TOC.

Bernard

> Is that possible to accomplish with the current header handling
> mechanisms and lilypond-book?  What would the rough outline look like?
>
> Thanks.
>

--
Bernard Hurley <[hidden email]>


_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Extracting header fields for use by e.g. LaTeX?

Michael Haynie
If I didn't have so many files to manage, I might consider that.  
However, there are enough that the double maintenance would drive me to
distraction.

The other problem with that solution is that it doesn't allow for the
placement of a song number beside the title -- think of the typical
layout of a hymnal.

So I really do need to figure out how to get lilypond to leave the
titling to LaTeX, somehow.

On Nov 26, 2005, at 9:16 PM, Bernard Hurley wrote:

> On Sat, 2005-11-26 at 20:26 -0500, Michael Haynie wrote:
>
> If you are using lilypond-book it is probably easier to forget about
> header fields and do something like:
>
> \section{Prelude}
> --- some other text ----
> \lilypondfile[indent=1.2\cm]{prelude.ly}
>
> in your lytex file. You can then easily generate a TOC.
>
> Bernard
>
>> Is that possible to accomplish with the current header handling
>> mechanisms and lilypond-book?  What would the rough outline look like?
>>
>> Thanks.
>>
>
> --
> Bernard Hurley <[hidden email]>
>



_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Extracting header fields for use by e.g. LaTeX?

Laura Conrad
>>>>> "MH" == Michael Haynie <[hidden email]> writes:


    MH> If I didn't have so many files to manage, I might consider that.  
    MH> However, there are enough that the double maintenance would drive me to
    MH> distraction.

    MH> The other problem with that solution is that it doesn't allow for the
    MH> placement of a song number beside the title -- think of the typical
    MH> layout of a hymnal.

    MH> So I really do need to figure out how to get lilypond to leave the
    MH> titling to LaTeX, somehow.

I have the same problem, but I do basically what Bernard suggested,
and write the .lytex file with a script that extracts the header
fields from the lilypond (or, in my case, the ABC file that's the
input for abc2ly).

    MH> On Nov 26, 2005, at 9:16 PM, Bernard Hurley wrote:

    >> If you are using lilypond-book it is probably easier to forget about
    >> header fields and do something like:
    >>
    >> \section{Prelude}
    >> --- some other text ----
    >> \lilypondfile[indent=1.2\cm]{prelude.ly}
    >>
    >> in your lytex file. You can then easily generate a TOC.

--
Laura (mailto:[hidden email] , http://www.laymusic.org/ )
(617) 661-8097 fax: (501) 641-5011
233 Broadway, Cambridge, MA 02139



_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Extracting header fields for use by e.g. LaTeX?

Bernard Hurley-3
In reply to this post by Michael Haynie
So it looks like you want to be able to do something like defining a
LaTeX macro \includesong {songfile} whose effect is something like:

--- do something with header info ----
\lilypondfile{songfile}

for that you do need lily to write the header info to a file. Actually
older versions of lily did do this before the days when it produced eps
files for lilypond-book so I can't see why it couldn't be reintroduced
as an option. You would also need an extra file so that header info
could be matched up with snippets. You would probably need to run LaTeX
several times for it to work, but if you are gereating a TOC you need to
do that anyway.

On Sun, 2005-11-27 at 00:48 -0500, Michael Haynie wrote:

> If I didn't have so many files to manage, I might consider that.  
> However, there are enough that the double maintenance would drive me to
> distraction.
>
> The other problem with that solution is that it doesn't allow for the
> placement of a song number beside the title -- think of the typical
> layout of a hymnal.
>
> So I really do need to figure out how to get lilypond to leave the
> titling to LaTeX, somehow.
>

--
Bernard Hurley <[hidden email]>


_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Extracting header fields for use by e.g. LaTeX?

Bernard Hurley-3
In reply to this post by Laura Conrad
On Sun, 2005-11-27 at 07:12 -0500, Laura Conrad wrote:

> I have the same problem, but I do basically what Bernard suggested,
> and write the .lytex file with a script that extracts the header
> fields from the lilypond (or, in my case, the ABC file that's the
> input for abc2ly).

You could write a script to extract header information from the .ly
file.  However to be completely general it would have to follow includes
and follow the same rules as lily e.g. recognising when one header
definition overrides another. It would be better if lily did this for
you. There was a time when it did - it probably still does if you use
the tex backend. But lilypond-book now uses the eps backend.
--
Bernard Hurley <[hidden email]>


_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Extracting header fields for use by e.g. LaTeX?

Laura Conrad
>>>>> "BH" == Bernard Hurley <[hidden email]> writes:

    BH> You could write a script to extract header information from
    BH> the .ly file.  However to be completely general it would have
    BH> to follow includes and follow the same rules as lily
    BH> e.g. recognising when one header definition overrides another.

That's why I didn't post my script; of course, it isn't completely
general, but it works for the way I do it.  And anyone with enough
files to maintain that they have Michael's problem will have some kind
of method that doesn't need a completely general script.

    BH> It would be better if lily did this for you.

I agree, but I also think that having the lilypond developers spend
time writing software that duplicates latex features (e.g. tables of
contents) is not a good use of resources.

    BH> There was a time when it did - it probably still does if you
    BH> use the tex backend. But lilypond-book now uses the eps
    BH> backend.

The 2.6.x lilypond-book does in fact take care of extracting title,
composer, and maybe a couple of other headers for you and putting them
in the lilypond-book output.  I think Michael's problem is that he
doesn't know how to get this output in the form he wants.  I haven't
looked at the problem much.  But it seems that it would be reasonable
to have some kind of hooks, so that, for instance, the title could be
output like:

        \section*{this is the title}

so that the latex table of contents could be used.  Or even:
        \section*{$hymn_number. this is the title}.

where $hymn_number could be replaced by the value of the header
"hymn_number".

--
Laura (mailto:[hidden email] , http://www.laymusic.org/ )
(617) 661-8097 fax: (501) 641-5011
233 Broadway, Cambridge, MA 02139



_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Extracting header fields for use by e.g. LaTeX?

Han-Wen Nienhuys
In reply to this post by Bernard Hurley-3
Bernard Hurley wrote:

> On Sun, 2005-11-27 at 07:12 -0500, Laura Conrad wrote:
>
>
>>I have the same problem, but I do basically what Bernard suggested,
>>and write the .lytex file with a script that extracts the header
>>fields from the lilypond (or, in my case, the ABC file that's the
>>input for abc2ly).
>
>
> You could write a script to extract header information from the .ly
> file.  However to be completely general it would have to follow includes
> and follow the same rules as lily e.g. recognising when one header
> definition overrides another. It would be better if lily did this for

try

   lilypond -H title foo.ly



--
  Han-Wen Nienhuys - [hidden email] - http://www.xs4all.nl/~hanwen


_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Extracting header fields for use by e.g. LaTeX?

Michael Haynie
In reply to this post by Bernard Hurley-3
Yes, that's exactly what I was thinking about doing.

So: Which scheme functions do I need to replace to accomplish that?
Are the suggested hooks are documented/supported hooks?

Thanks.

On Nov 27, 2005, at 8:46 AM, Bernard Hurley wrote:

> So it looks like you want to be able to do something like defining a
> LaTeX macro \includesong {songfile} whose effect is something like:
>
> --- do something with header info ----
> \lilypondfile{songfile}
>
> for that you do need lily to write the header info to a file. Actually
> older versions of lily did do this before the days when it produced eps
> files for lilypond-book so I can't see why it couldn't be reintroduced
> as an option. You would also need an extra file so that header info
> could be matched up with snippets. You would probably need to run LaTeX
> several times for it to work, but if you are gereating a TOC you need
> to
> do that anyway.
>
> On Sun, 2005-11-27 at 00:48 -0500, Michael Haynie wrote:
>> If I didn't have so many files to manage, I might consider that.
>> However, there are enough that the double maintenance would drive me
>> to
>> distraction.
>>
>> The other problem with that solution is that it doesn't allow for the
>> placement of a song number beside the title -- think of the typical
>> layout of a hymnal.
>>
>> So I really do need to figure out how to get lilypond to leave the
>> titling to LaTeX, somehow.
>>
>
> --
> Bernard Hurley <[hidden email]>
>



_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Extracting header fields for use by e.g. LaTeX?

Bernard Hurley-3
In reply to this post by Han-Wen Nienhuys
On Sun, 2005-11-27 at 15:56 +0100, Han-Wen Nienhuys wrote:
> try
>
>    lilypond -H title foo.ly
>
Interesting this is not listed as a command line options in the docs,
but lilypond --help tells you what happens. To use with lilypond-book, I
suppose you could do:
        lilypond-book --process="lilypond -H title" ....
>
>
--
Bernard Hurley <[hidden email]>


_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Extracting header fields for use by e.g. LaTeX?

Bernard Hurley-3
In reply to this post by Michael Haynie
On Sun, 2005-11-27 at 13:13 -0500, Michael Haynie wrote:
> Yes, that's exactly what I was thinking about doing.
>
> So: Which scheme functions do I need to replace to accomplish that?
> Are the suggested hooks are documented/supported hooks?
>

I don't think scheme is going to help. I thnk the solution is to modify
lilypond-book slightly.

However if you take the files

--- test.lytex ---
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\lilypondfile{test.ly}
\end{document}
------------------

and
---- test.ly -------
\version "2.7.18"

\header {
    title="The test title"
    composer="Bernard Hurley"
}

{a b c}
--------------------

and run:
lilypond-book --psfonts --process="lilypond -b eps -H title " test.lytex

you get a file called something like:

lily-1915112629.title

which contains the text of the header "title" - you can do the same with
any other header.

in addition to the generated test.tex

Now the file test.tex contains the code:

-------------test.tex------------
........
\ifx\preLilyPondExample \undefined
  \relax
\else
  \preLilyPondExample
\fi
\def\lilypondbook{}%
\input lily-1915112629-systems.tex
.......
--------------------------------

Now
\input lily-1915112629-systems.tex
Notice:
1] The files lily-1915112629-systems.tex and lily-1915112629.title both
start with "lily-1915112629" so this prefix must be available to
lilypond-book when it generates this code.
2] notice the macro call \preLilyPondExample (it only takes effect if
the macro is defined). If lilypond-book were modified so that it
generated the parameter {lily-1915112629}. Then it would be possible for
you to define the macro so that it read the file with the header.

Actually this modification looks quite easy. The real problem is whether
this would break any existing lytex code. (It can't be upgraded with
convert-ly because that just upgrades lily files). Another solution
would be to have two user-definable macros in the same place, which
seems a bit silly.

I'll have a think about it and then submit a patch.

--
Bernard Hurley <[hidden email]>


_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Extracting header fields for use by e.g. LaTeX?

Laura Conrad
>>>>> "BH" == Bernard Hurley <[hidden email]> writes:

    BH> Notice:
    BH> 1] The files lily-1915112629-systems.tex and lily-1915112629.title both
    BH> start with "lily-1915112629" so this prefix must be available to
    BH> lilypond-book when it generates this code.

This seems a little baroque (in the bad sense) to me.  Why not just
run "lilypond -H title test.ly" and get test.title, which you can then
include quite easily?

--
Laura (mailto:[hidden email] , http://www.laymusic.org/ )
(617) 661-8097 fax: (501) 641-5011
233 Broadway, Cambridge, MA 02139



_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Extracting header fields for use by e.g. LaTeX?

Michael Haynie
In reply to this post by Bernard Hurley-3
That looks like a nice hook.

I suppose I'd also have to tell lilypond to not generate the header for
each song somehow, since I'm going to be handling that myself.

The change to \preLilypondExample can be made backward compatible by
defining a variable that preLilypondExample can rely on -- it's a bit
of a hack, though.  Using a parameter might be worth a little breakage,
since there will not likely be a huge number of places to edit.

One thing, though: using 2.6.4 (on Mac OS X, at least), lilypond-book
seems to insist on parsing the --process arguments, and so complains
that -b isn't a valid option.  If a patch is possible against 2.6, that
should also be corrected.

I'll be delighted to test the patch.

On Nov 27, 2005, at 5:22 PM, Bernard Hurley wrote:

> On Sun, 2005-11-27 at 13:13 -0500, Michael Haynie wrote:
>> Yes, that's exactly what I was thinking about doing.
>>
>> So: Which scheme functions do I need to replace to accomplish that?
>> Are the suggested hooks are documented/supported hooks?
>>
>
> I don't think scheme is going to help. I thnk the solution is to modify
> lilypond-book slightly.
>
> However if you take the files
>
> --- test.lytex ---
> \documentclass{article}
> \usepackage{graphicx}
> \begin{document}
> \lilypondfile{test.ly}
> \end{document}
> ------------------
>
> and
> ---- test.ly -------
> \version "2.7.18"
>
> \header {
>     title="The test title"
>     composer="Bernard Hurley"
> }
>
> {a b c}
> --------------------
>
> and run:
> lilypond-book --psfonts --process="lilypond -b eps -H title "
> test.lytex
>
> you get a file called something like:
>
> lily-1915112629.title
>
> which contains the text of the header "title" - you can do the same
> with
> any other header.
>
> in addition to the generated test.tex
>
> Now the file test.tex contains the code:
>
> -------------test.tex------------
> ........
> \ifx\preLilyPondExample \undefined
>   \relax
> \else
>   \preLilyPondExample
> \fi
> \def\lilypondbook{}%
> \input lily-1915112629-systems.tex
> .......
> --------------------------------
>
> Now
> \input lily-1915112629-systems.tex
> Notice:
> 1] The files lily-1915112629-systems.tex and lily-1915112629.title both
> start with "lily-1915112629" so this prefix must be available to
> lilypond-book when it generates this code.
> 2] notice the macro call \preLilyPondExample (it only takes effect if
> the macro is defined). If lilypond-book were modified so that it
> generated the parameter {lily-1915112629}. Then it would be possible
> for
> you to define the macro so that it read the file with the header.
>
> Actually this modification looks quite easy. The real problem is
> whether
> this would break any existing lytex code. (It can't be upgraded with
> convert-ly because that just upgrades lily files). Another solution
> would be to have two user-definable macros in the same place, which
> seems a bit silly.
>
> I'll have a think about it and then submit a patch.
>
> --
> Bernard Hurley <[hidden email]>
>



_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Extracting header fields for use by e.g. LaTeX?

Bernard Hurley-3
In reply to this post by Laura Conrad
If you have a song book with 20 songs, it would be nice if you could
define  \preLilyPondExample _once_ and then include the songs with
\lilypondfile. That way they would all be handled identically. You could
add and delete songs at will. Also you could change the way they are
handled by changing the macro \preLilyPondExample. The problem at
present is that lilypond-book does not generate a macro with a parameter
so there is no way to get hold of the .title file in the generated latex
code except by adding it by hand. You would also have to work out which
file you need - it's not obvious -look at the generated latex. So I
think the problem is most easily solved by changing llypond-book.

The way it would work is:

lilypond-book would have an extra option (-M or --mparam, say). If used
it would cause lilypond-book to generate a call to \preLilyPondExample
with an extra parameter, which would have the value of the base name of
the snippet file. So for instance if you were writing:

\section {title-of-song-1}
\lilypondfile {song1}
\section {title-of-song-2}
\lilypondfile {song2}
....
....
\section {title-of-song-n}
\lilypondfile {songn}

You could instead code:

\newcommand {\preLilyPondExample}[1]{\section {\protect\input #1.title }}

and then

\lilypondfile {song1}
\lilypondfile {song2}
....
....
\lilypondfile {songn}

Bernard

On Sun, 2005-11-27 at 18:19 -0500, Laura Conrad wrote:

> >>>>> "BH" == Bernard Hurley <[hidden email]> writes:
>
>     BH> Notice:
>     BH> 1] The files lily-1915112629-systems.tex and lily-1915112629.title both
>     BH> start with "lily-1915112629" so this prefix must be available to
>     BH> lilypond-book when it generates this code.
>
> This seems a little baroque (in the bad sense) to me.  Why not just
> run "lilypond -H title test.ly" and get test.title, which you can then
> include quite easily?
>
--
Bernard Hurley <[hidden email]>


_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Extracting header fields for use by e.g. LaTeX?

Bernard Hurley-3
In reply to this post by Michael Haynie
On Sun, 2005-11-27 at 18:38 -0500, Michael Haynie wrote:

> The change to \preLilypondExample can be made backward compatible by
> defining a variable that preLilypondExample can rely on -- it's a bit
> of a hack, though.  Using a parameter might be worth a little breakage,
> since there will not likely be a huge number of places to edit.
>

No it can't be made backward compatible like that, since an optional
parameter has to be declared in the definition of a macro, what
lilypond-book generates is a _call_ to the macro. However (I hadn't
thought of this in my previous post) you can get backward compatibility
by adding another command line option for lilypond-book

> One thing, though: using 2.6.4 (on Mac OS X, at least), lilypond-book
> seems to insist on parsing the --process arguments, and so complains
> that -b isn't a valid option.  If a patch is possible against 2.6, that
> should also be corrected.
>

That looks like a bug to me. It doesn't happen using 2.6.3 on Debian.
Are you sure you quoted the arguments correctly? Check it again and if
it still doesn't work email the bug list

> I'll be delighted to test the patch.
>

Thanks, I have been working with 2.7.x, but I don't think lilypond-book
has changed much so I'll see what I can do!

>
--
Bernard Hurley <[hidden email]>


_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Extracting header fields for use by e.g. LaTeX?

Michael Haynie

On Nov 27, 2005, at 9:36 PM, Bernard Hurley wrote:

> On Sun, 2005-11-27 at 18:38 -0500, Michael Haynie wrote:
>
>> The change to \preLilypondExample can be made backward compatible by
>> defining a variable that preLilypondExample can rely on -- it's a bit
>> of a hack, though.

two different ideas here -- global variable above, parameter below.  
Sorry about that.

>> Using a parameter might be worth a little breakage,
>> since there will not likely be a huge number of places to edit.
>>
>
> No it can't be made backward compatible like that, since an optional
> parameter has to be declared in the definition of a macro, what
> lilypond-book generates is a _call_ to the macro. However (I hadn't
> thought of this in my previous post) you can get backward compatibility
> by adding another command line option for lilypond-book
>

Having lilypond-book write two different forms of the call might be OK.

>> One thing, though: using 2.6.4 (on Mac OS X, at least), lilypond-book
>> seems to insist on parsing the --process arguments, and so complains
>> that -b isn't a valid option.  If a patch is possible against 2.6,
>> that
>> should also be corrected.
>>
>
> That looks like a bug to me. It doesn't happen using 2.6.3 on Debian.
> Are you sure you quoted the arguments correctly? Check it again and if
> it still doesn't work email the bug list

I did, it doesn't, and I will.

>
>> I'll be delighted to test the patch.
>>
>
> Thanks, I have been working with 2.7.x, but I don't think lilypond-book
> has changed much so I'll see what I can do!
>
>>
> --
> Bernard Hurley <[hidden email]>
>



_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Extracting header fields for use by e.g. LaTeX?

Bernard Hurley-3
In reply to this post by Bernard Hurley-3
I have thought of a better way of doing this:

modify \lilypondfile so that it takes an optional argument as in:

lilypondfile[reference]{mysong.ly}

The idea is that without the optional parameter it would work as before,
but with the parameter, it would work as follows:

1] the eps files, (e.g. lily-1915112629-1.eps,  lily-1915112629-2.eps)
would be generated as before, but _not_ included in the tex file.

2] there would be tex commands automatically generated so that:
        \referenceBase would have value base name of generated files
(lily-1915112629 in this case)
        \referenceCount would have value number of eps files generated.
maybe we could also have:
        \referenceFile defined as the file name (mysong.ly in this case)

This would mean that it would be easy to generate names of the .eps
files, any files containing headers (e.g. lily-1915112629.title) etc,
these could then be input or dealt with in other ways. It opens up all
sorts of possiblities. For instance if you wanted to put the lilypond
source code into you document you could construct the name of it (in
this case lily-1915112629.ly). You would have complete control over how
and where the files are processed. (So if you had a contents page that
used a scaled down, and clipped version of the first system of a son,
this could be done).

I think I know how to do this, but there are a few minor bugs in
lilypondbook that need fixing first. I expect to be able to submit a
patch to the developer list in the next two weeks.

It might also be a good idea if lilypond-book could take a -H option
that would then be passed on to lilypond.
--
Bernard Hurley <[hidden email]>


_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Extracting header fields for use by e.g. LaTeX?

Michael Haynie
Interesting.  Very clean from a compatibility point-of-view.

I guess lilypondfile would call a macro if was defined, and include
everything otherwise? Maybe \includeLilypondSystems{}

Many users might have no idea how to define the macro to include a
sequence of generated files.

We should provide a macro for the default case (include everything, in
order) and a common alternate (include n systems, starting with the kth
one).  Even though I've written 2000 page documents in LaTeX, I'd have
to think about how to do that for a bit.

I like the -H option as well -- it will greatly simplify invocation for
this case, and cases like it.

On Nov 30, 2005, at 7:08 AM, Bernard Hurley wrote:

> I have thought of a better way of doing this:
>
> modify \lilypondfile so that it takes an optional argument as in:
>
> lilypondfile[reference]{mysong.ly}
>
> The idea is that without the optional parameter it would work as
> before,
> but with the parameter, it would work as follows:
>
> 1] the eps files, (e.g. lily-1915112629-1.eps,  lily-1915112629-2.eps)
> would be generated as before, but _not_ included in the tex file.
>
> 2] there would be tex commands automatically generated so that:
> \referenceBase would have value base name of generated files
> (lily-1915112629 in this case)
> \referenceCount would have value number of eps files generated.
> maybe we could also have:
> \referenceFile defined as the file name (mysong.ly in this case)
>
> This would mean that it would be easy to generate names of the .eps
> files, any files containing headers (e.g. lily-1915112629.title) etc,
> these could then be input or dealt with in other ways. It opens up all
> sorts of possiblities. For instance if you wanted to put the lilypond
> source code into you document you could construct the name of it (in
> this case lily-1915112629.ly). You would have complete control over how
> and where the files are processed. (So if you had a contents page that
> used a scaled down, and clipped version of the first system of a son,
> this could be done).
>
> I think I know how to do this, but there are a few minor bugs in
> lilypondbook that need fixing first. I expect to be able to submit a
> patch to the developer list in the next two weeks.
>
> It might also be a good idea if lilypond-book could take a -H option
> that would then be passed on to lilypond.
> --
> Bernard Hurley <[hidden email]>
>



_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Extracting header fields for use by e.g. LaTeX?

Mats Bengtsson-6
I recommend that you look at the LaTeX code generated by lilypond-book
today. Basically, it just adds a
\input lily-148554130-systems.tex
in the main file. This lily-*-systems.tex file, in turn, contains a
number of
\includegraphics commands, one for each score line.

   /Mats

Michael Haynie wrote:

> Interesting.  Very clean from a compatibility point-of-view.
>
> I guess lilypondfile would call a macro if was defined, and include
> everything otherwise? Maybe \includeLilypondSystems{}
>
> Many users might have no idea how to define the macro to include a
> sequence of generated files.
>
> We should provide a macro for the default case (include everything, in
> order) and a common alternate (include n systems, starting with the
> kth one).  Even though I've written 2000 page documents in LaTeX, I'd
> have to think about how to do that for a bit.
>
> I like the -H option as well -- it will greatly simplify invocation
> for this case, and cases like it.
>
> On Nov 30, 2005, at 7:08 AM, Bernard Hurley wrote:
>
>> I have thought of a better way of doing this:
>>
>> modify \lilypondfile so that it takes an optional argument as in:
>>
>> lilypondfile[reference]{mysong.ly}
>>
>> The idea is that without the optional parameter it would work as before,
>> but with the parameter, it would work as follows:
>>
>> 1] the eps files, (e.g. lily-1915112629-1.eps,  lily-1915112629-2.eps)
>> would be generated as before, but _not_ included in the tex file.
>>
>> 2] there would be tex commands automatically generated so that:
>>     \referenceBase would have value base name of generated files
>> (lily-1915112629 in this case)
>>     \referenceCount would have value number of eps files generated.
>> maybe we could also have:
>>     \referenceFile defined as the file name (mysong.ly in this case)
>>
>> This would mean that it would be easy to generate names of the .eps
>> files, any files containing headers (e.g. lily-1915112629.title) etc,
>> these could then be input or dealt with in other ways. It opens up all
>> sorts of possiblities. For instance if you wanted to put the lilypond
>> source code into you document you could construct the name of it (in
>> this case lily-1915112629.ly). You would have complete control over how
>> and where the files are processed. (So if you had a contents page that
>> used a scaled down, and clipped version of the first system of a son,
>> this could be done).
>>
>> I think I know how to do this, but there are a few minor bugs in
>> lilypondbook that need fixing first. I expect to be able to submit a
>> patch to the developer list in the next two weeks.
>>
>> It might also be a good idea if lilypond-book could take a -H option
>> that would then be passed on to lilypond.
>> --
>> Bernard Hurley <[hidden email]>
>>
>
>
>
> _______________________________________________
> lilypond-user mailing list
> [hidden email]
> 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
        Email: [hidden email]
        WWW: http://www.s3.kth.se/~mabe
=============================================



_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Extracting header fields for use by e.g. LaTeX?

Bernard Hurley-3
On Thu, 2005-12-01 at 10:47 +0100, Mats Bengtsson wrote:
> I recommend that you look at the LaTeX code generated by lilypond-book
> today. Basically, it just adds a
> \input lily-148554130-systems.tex
> in the main file. This lily-*-systems.tex file, in turn, contains a
> number of
> \includegraphics commands, one for each score line.
>
>    /Mats
>

This is true, but the problem for the user is getting at the number
148554130 and then using it in a macro. I Michael's point, I think, is
that not many users would be able to do this so the macro had better be
pre-written. BTW I sent my reply to Michael's post to the developer list
instead of this one as we are now discussing new funcionality for
lilypond-book

        /Bernard

> Michael Haynie wrote:
>
> > Interesting.  Very clean from a compatibility point-of-view.
> >
> > I guess lilypondfile would call a macro if was defined, and include
> > everything otherwise? Maybe \includeLilypondSystems{}
> >
> > Many users might have no idea how to define the macro to include a
> > sequence of generated files.
> >
> > We should provide a macro for the default case (include everything, in
> > order) and a common alternate (include n systems, starting with the
> > kth one).  Even though I've written 2000 page documents in LaTeX, I'd
> > have to think about how to do that for a bit.
> >
> > I like the -H option as well -- it will greatly simplify invocation
> > for this case, and cases like it.
> >
> > On Nov 30, 2005, at 7:08 AM, Bernard Hurley wrote:
> >
> >> I have thought of a better way of doing this:
> >>
> >> modify \lilypondfile so that it takes an optional argument as in:
> >>
> >> lilypondfile[reference]{mysong.ly}
> >>
> >> The idea is that without the optional parameter it would work as before,
> >> but with the parameter, it would work as follows:
> >>
> >> 1] the eps files, (e.g. lily-1915112629-1.eps,  lily-1915112629-2.eps)
> >> would be generated as before, but _not_ included in the tex file.
> >>
> >> 2] there would be tex commands automatically generated so that:
> >>     \referenceBase would have value base name of generated files
> >> (lily-1915112629 in this case)
> >>     \referenceCount would have value number of eps files generated.
> >> maybe we could also have:
> >>     \referenceFile defined as the file name (mysong.ly in this case)
> >>
> >> This would mean that it would be easy to generate names of the .eps
> >> files, any files containing headers (e.g. lily-1915112629.title) etc,
> >> these could then be input or dealt with in other ways. It opens up all
> >> sorts of possiblities. For instance if you wanted to put the lilypond
> >> source code into you document you could construct the name of it (in
> >> this case lily-1915112629.ly). You would have complete control over how
> >> and where the files are processed. (So if you had a contents page that
> >> used a scaled down, and clipped version of the first system of a son,
> >> this could be done).
> >>
> >> I think I know how to do this, but there are a few minor bugs in
> >> lilypondbook that need fixing first. I expect to be able to submit a
> >> patch to the developer list in the next two weeks.
> >>
> >> It might also be a good idea if lilypond-book could take a -H option
> >> that would then be passed on to lilypond.
> >> --
> >> Bernard Hurley <[hidden email]>
> >>
> >
> >
> >
> > _______________________________________________
> > lilypond-user mailing list
> > [hidden email]
> > http://lists.gnu.org/mailman/listinfo/lilypond-user
>
>
--
Bernard Hurley <[hidden email]>


_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user